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?
-
why this function has changed
C-style comments
/* ... */
have been valid in VHDL since VHDL-2008 (aka VHDL 4.0).Some references:
- https://www.doxygen.nl/manual/docblocks.html#vhdlblocks
- https://www.doulos.com/httpswwwdouloscomknowhow/vhdl/vhdl-2008-small-changes/#comment
- https://www.doulos.com/knowhow/vhdl_designers_guide/vhdl_2008/vhdl_200x_small/#env
- https://www.intel.com/content/www/us/en/programmable/quartushelp/13.0/mergedProjects/hdl/ahdl/ahdl_guide_comments_documentation.htm
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):
- https://ieeexplore.ieee.org/document/4772740 => Section 15.9 “Comments” (emphasis added)
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.
– 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 commitd20e11b
, wherelangs.model.xml
(and thuslangs.xml
) was updated for VHDL-2008 support, including adding thecommentStart
andcommentEnd
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 thecommentStart
andcommentEnd
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.
-
@PeterJones FYI - although VHDL 2008 is indeed the latest standard, it is not the default standard for a lot of tools. In addition, it is not uncommon to lock a legacy product to an older version of a synthesis tool, for which VHDL 2008 support does not exist at all. In other words, while VHDL 2008 support can be (explicitly) enabled in contemporary versions of any simulation / synthesis tool, you may, for a variety of practical reasons, not actually want to do so.
Notepad++ is therefore enforcing a style that is not supported by all code bases, and should, as OP is suggesting, revert to block-commenting with “–” on every line, as this is backward compatible.
-
@Mike-Tyson said in VDHL Block comment adding incorrect delimiter:
should, as OP is suggesting, revert to block-commenting with “–” on every line, as this is backward compatible
I maintain that it is already configurable, and my post from a year ago already explained how to configure it. If this is not sufficient for your needs, you are free to put in a feature request (as explained in this FAQ), as we can do nothing about changing the codebase in this Community of fellow users of Notepad++