Bug or problem with block comment in another block comment



  • Hi All

    i found some problem with block comment.
    So.
    {} blok comment

    307136a6-53cf-4d1b-9837-ac18139f703f-image.png

    add block comment

    608f4b97-8336-4f40-b7d9-e7cb904389b7-image.png

    its fine
    but if a add another block comment over exist.

    7ee2f9c4-ba55-41b9-8add-52411ba159be-image.png

    do not worked.

    if block comment include another block comment. it is not working.

    Sorry for may english.



  • @Andrey ,

    What language lexer has block comments like that? Or are you using a UDL?

    And does that language actually allow nested comments? Some languages do, some don’t, and some leave it up to a compiler implementation decision.

    If the language really allows it, but the built-in lexer allows it, then technically, that’s a bug in the lexer. However, the lexers that ship with Notepad++ are part of the Scintilla code library that Notepad++ uses, so it would be a long, unlikely process to get it fixed (report the bug to Scintilla; wait for it to maybe get fixed; request Notepad++ update its Scintilla; wait for likely many years before Notepad++ does update its Scintilla, if ever)

    If you are using a UDL, that lexer uses a very simple algorithm, which was not built to handle nested comments (and even if you submitted an issue on it, the UDL lexer, even though technically controlled by Notepad++ unlike the other lexers, hasn’t had any significant improvements in years)

    You can add extra highlighting to a builtin lexer or to a User Defined Language (UDL) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo, but you might have to tweak his code to be able to handle nested comments.

    My general coding practice on nested comments: don’t.


Log in to reply