How do i remove the space when creating comments, when i coment or uncomment this line
// console.log('Lorem Ipsum');
I get additional white space in the beginning.
How do i remove the space when creating comments, when i coment or uncomment this line
// console.log('Lorem Ipsum');
I get additional white space in the beginning.
This is determined from the syntax definition. Specifically the Comments.tmPreferences.
Hi,
i have tried this and put it in my ~/Library/Application Support/Sublime Text 3/Packages/JavaScript folder but it didn’t work.
i have set <string>// </string>
to <string>//</string>
It works when I do it here; are you seeing anything in the console that indicates an error? What does the content of your Comments.tmPreferences
file look like?
Here’s the XML I created. btw I created the folder JavaScript as my sublime doesn’t have it in Library. I don’t get any errors in the console also.
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.js</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>//</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
</dict>
</plist>
While you’re editing one of the files where you want this to work, choose Tools > Developer > Show Scope Name
; this makes a popup appear that shows you the full scope of the text at the cursor. Is the first like source.js
or something different?
As long as the file is inside of a package, Sublime will find it and load it. You can tell if Sublime is noticing your file by intentionally breaking the XML in it and then saving the file; you should get an error message.
yes it does break. when i try to delete one of the < character it gives me this
error loading meta info from Packages/JavaScript/Comments.tmPreferences: Error parsing plist xml: expected > in file Packages/JavaScript/Comments.tmPreferences on line: 12
but when I try to change the <string>//</string>
it doesn’t take effect. even if try to do this <string>test</string>
. Although when i save it i need to press cmd + / a few times before it will take effect.
Would there be any Packages installation that would interfere with this file?
It’s possible that another package you have installed could include a similar file (using the same scope
, specifically); if that was the case then it would load after this package and potentially cause issues.
You could test that by putting this file in your User
package instead; that package is always loaded last and “wins” all disputes that involve similar things being provided by multiple packages.
This is the more worrying part of this; the change to the file should either work or not work, it shouldn’t sometimes work.
Something to try would be to open the Sublime console with View > Show Console
and then enter sublime.log_commands(True)
and press the key combination for commenting a file (in the same place where you see this issue) and double check that it’s executing the command toggle_comment
with an argument of { "block": false}
; if it says something else, then a package is stealing the key binding (perhaps in only specific situations).
thank you very much!!! i did the sublime.log_commands(True)
and found this
command: naomi_toggle_jsx_comment {"block": false}
uninstalled naomi(i don’t use it anyway) and everything works perfectly!