stef-levesque/vscode-autohotkey

Toggle Line Comment

catfist opened this issue · 4 comments

now Toggle Line Comment insert two spaces. like this

;  Comment line
0123

Please modify ahk.configuration.json

-		"lineComment": "; ",
+		"lineComment": ";",

Fixed in version 0.2.0

As the description in the following document, the line comment should be space + ; or tab + ; instead of just a ;

A comment flag that appears on the same line as a command is not considered to mark a comment unless it has at least one space or tab to its left. For example:

MsgBox, Test1 ; This is a comment.
MsgBox, Test2; This is not a comment and will be displayed by MsgBox.

https://autohotkey.com/docs/commands/_CommentFlag.htm

I think the following change in ahk.tmLanguage should properly cover all cases:

<dict>
  <key>captures</key>
  <dict>
    <key>1</key>
    <dict>
      <key>name</key>
      <string>punctuation.definition.comment.ahk</string>
    </dict>
  </dict>
  <key>match</key>
  <string>\s(;).*</string>
  <key>name</key>
  <string>comment.line.semicolon.ahk</string>
</dict>
<dict>
  <key>captures</key>
  <dict>
    <key>1</key>
    <dict>
      <key>name</key>
      <string>punctuation.definition.comment.ahk</string>
    </dict>
  </dict>
  <key>match</key>
  <string>^(;).*</string>
  <key>name</key>
  <string>comment.line.semicolon.ahk</string>
</dict>

Fixed in version 0.2.1