stef-levesque / vscode-autohotkey

AutoHotkey language support for VS Code
MIT License
96 stars 23 forks source link

Wrong block comment highlight #9

Closed myfonj closed 6 years ago

myfonj commented 6 years ago

/* and */ symbols can be used to comment out an entire section, but only if the symbols appear at the beginning of a line (…)

https://autohotkey.com/docs/Language.htm#comments

It has quite nasty effect that there is no such thing as /* */ in AHK we are probably used to form other languages:

TTT (text)
/* CCC (comment) */ CCC
/* */ CCC
CCC */ CCC
*/ TTT
myfonj commented 6 years ago

For demonstration, current highlight: ahk-comment-highlight-bad 4b16c Correct highlight: ahk-comment-highlight-good 4b16c

stef-levesque commented 6 years ago

Using the RegExp '^/*' and '^*/' should work then. I'll have a look at it tomorrow.

myfonj commented 6 years ago

Yup. It is not clearly stated in docs, but testing revealed that whitespace is not counted to the beginning of a line here, just like in other tokens already in syntax. So that's why ^\s*/\* in PR.

myfonj commented 6 years ago

And one other quite weird thing: unbalanced */ itself yields no syntax error (provided it starts a line) and is simply ignored if there was no /* above. So perhaps it would be relevant to add such token as well.

myfonj commented 6 years ago

Any chance bumping this fix to the Marketplace?

stef-levesque commented 6 years ago

Yes, I'll push a new release this week.