stef-levesque / vscode-autohotkey

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

Toggle Line Comment #5

Closed catfist closed 7 years ago

catfist commented 7 years ago

now Toggle Line Comment insert two spaces. like this

;  Comment line
0123

Please modify ahk.configuration.json

-       "lineComment": "; ",
+       "lineComment": ";",
stef-levesque commented 7 years ago

Fixed in version 0.2.0

Blacktea0 commented 7 years ago

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

stef-levesque commented 7 years ago

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>
stef-levesque commented 7 years ago

Fixed in version 0.2.1