VDHL Block comment adding incorrect delimiter



  • Running version v8.1.1 64 bit of Notepad++. When I highlight a group of lines and right click and ask for a block comment the insert is a /* … */ around the block of text. This is not correct for VHDL. It should just insert “–” at the start of each line.

    Inversion 7.5.9 the proper insertion is done.

    Where can I look to find out why this function has changed and how can I correct it?



  • @Paul-Fitch

    why this function has changed

    C-style comments /* ... */ have been valid in VHDL since VHDL-2008 (aka VHDL 4.0).

    Some references:

    and, most importantly, in the IEEE Std 1076-2008 (but without IEEE Xplore, you might not be able to see it, so I will make a small quote and screenshot, hoping that such a small section is within fair use):

    A comment is either a single-line comment or a delimited comment. A single-line comment starts with two adjacent hyphens and extends up to the end of the line. A delimited comment starts with a solidus (slash) character immediately followed by an asterisk character and extends up to the first subsequent occurrence of an asterisk character immediately followed by a solidus character.

    bc04f461-95e4-478d-8982-9ef91a39a551-image.png

    Copyright © 2009 IEEE. All rights reserved. (Quoted under fair use.)

    Regarding Notepad++ and VHDL:

    I did some bisecting of the Notepad++ versions I have. Originally, I thought it was going to be a feature of the lexer, and thus was checking the NPP versions where Scintilla was updated (v7.7, v7.8, v7.9.4)… but that didn’t turn out to be it. NPP used just -- in v7.8.6, but used /* ... */ for v7.8.7. I believe it was commit d20e11b, where langs.model.xml (and thus langs.xml) was updated for VHDL-2008 support, including adding the commentStart and commentEnd attributes to the VHDL language start tag.

    You asked:

    how can I correct it?

    If you want to “correct it” (ie, disable VHDL-2008 support) in v7.8.7 and onward, you are able to edit langs.xml (following “Editing Configuration Files” recommendations from the user manual), and remove the commentStart and commentEnd attributes to the VHDL language, so it will change from:

       <Language name="vhdl" ext="vhd vhdl" commentLine="--" commentStart="/*" commentEnd="*/">
    

    to

       <Language name="vhdl" ext="vhd vhdl" commentLine="--">
    

    If you edit the file, save the change, exit Notepad++, and come back; when I do that, the comment-block command will use multiple -- single-line comments for the block, instead of using the VHDL-2008-and-newer comment-block syntax. (My experiment with v7.8.7 showed this to be true.)

    So, if you want to only use line-style comments when using block-style comment command, just remove those two attributes from the config file.

    Good luck.


Log in to reply