With User Defined Languages, Can Comments be Limited to Beginning of Line?
Geoffrey Odhner last edited by
When creating a user defined language, defining the comment style, there is a selection for “Line comment position” to “Force at beginning of line”, but it doesn’t force the comments to be placed at the beginning of the line as one might expect. Instead they are placed at the first word on the line, after the white space, despite the fact that I haven’t selected the alternate option “Allow preceding white space”. This seems as if the option is a meaningless option when defining the language! Ideally I should be able to define two different types of comments, one which is constrained to the beginnings of lines, and another which is not, but as it is, I am unable to define any that is constrained.
Is there anyone who knows the language definition system who can help me with this conundrum? Thanks in advance for you help.
Meta Chuh last edited by Meta Chuh
welcome to the notepad++ community
the line comment option “force at beginning of line” refers to the comment marker (delimiter), not to the comment itself.
here’s a screenshot with a little example of what will and what won’t be interpreted as a comment if you use it. (comments are highlighted in green)
you are correct about the global meaning of this setting, it is not possible to set one line comment delimiter string that will work everywhere and another one that’s only valid at the beginning of a line.
the only workaround i know of is to use a comment line setting restricted to the beginning of the line and a block comment, which you could use everywhere, but which has to have separate open and close delimiters like
*/as they don’t end automatically at the break of a line