Menu

#1270 Question about adding CMake 3 features

Completed
closed
5
2020-10-02
2019-03-20
Jad Altahan
No

I'd like to ask about the CMake lexer, as it's slightly outdated. The release of CMake 3.0 came with notable changes, which include:

Any plans for updating it? Or do you wish to keep it as it is for compatiblity reasons?

I already have a patch I wrote on Feb 2 to implement bracket comments capability. I can attach it if you are interested in updating the lexer. I can also work of the rest of the new features in my free time.

Discussion

  • Jad Altahan

    Jad Altahan - 2019-03-20

    Please change the ticket title to "Question about adding CMake 3 features" or something more related to the ticket. The title is old and my browser cached it.

     
  • Neil Hodgson

    Neil Hodgson - 2019-03-21
    • summary: [PATCH] Support for CMake 3.0 bracket comment --> Question about adding CMake 3 features
     
  • Neil Hodgson

    Neil Hodgson - 2019-03-21

    The CMake lexer has not seen much work - there is the original contribution from 2007 and one fix from Geany.

    New features are great but so is compatibility. Its reasonable to add new style numbers for these features as their current styling appears incorrect if I understand the constructs correctly.

     
    • Jad Altahan

      Jad Altahan - 2019-03-21

      For compatibility, I'm thinking we could toggle new features with custom properties, but since LexCMake doesn't use the new ILexer4 protocol, would custom properties like styler.GetPropertyInt("lexer.cmake.bracket.arguments", 0) work?

       
      • Neil Hodgson

        Neil Hodgson - 2019-03-21

        Properties work with functional lexers (see LexCSS.cxx) as well as object lexers derived from ILexer4. ILexer* provides runtime metadata so applications can ask which properties they can set.

        The new constructs currently lex poorly so I don't think a gating property is worth the effort. Applications will default this on to more accurately visualize the text and its unlikely any users will have files that will appear better with it turned off.

        There may be a small chance of programmatic breakage like a script that looks for meaningful comments which will stop working if the style of those comments changes, but I think that is not worth worrying about in this case. For example, somethng like a script that looks for comments following a convention for linking issues

        #[[Bug: https://sourceforge.net/p/scintilla/bugs/2091/
        Fix optimization option on BSD.]]
        
         
  • Neil Hodgson

    Neil Hodgson - 2019-04-16
    • status: open --> closed
     
  • Zufu Liu

    Zufu Liu - 2019-08-07

    I think this need be implemented.
    The bracket comment is heavily used in cmake's source, you can check files in cmake-version\Modules folder.
    Many file in the Modules folder has following (from AddFileDependencies.cmake) reST document comment:

    #[=======================================================================[.rst:
    AddFileDependencies
    -------------------
    
    Add dependencies to a source file.
    
    .. code-block:: cmake
    
      ADD_FILE_DEPENDENCIES(<source> <files>)
    
    Adds the given ``<files>`` to the dependencies of file ``<source>``.
    #]=======================================================================]
    

    Because of examples in document comment (see FindwxWidgets.cmake), without implementing bracket comment, the whole document will be incorrectly colored/folded.
    https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindwxWidgets.cmake

    I have some code at (the lexer is a different one)
    https://github.com/zufuliu/notepad2/commit/093fe1feeb592655f3edb2df6feea74ebea5744a
    https://github.com/zufuliu/notepad2/commit/8ec8d0c29ed597cb452041e63c1472ec08fb88ad

     

Log in to post a comment.