Sublime Forum

Toggle comment not working [Solved]

#1

[size=150][Solved update][/size]
[Problem]
Can’t toggle comment, can’t search functions in the search box start with “@”, but syntax highlight works fine.
[Solution]
http://www.sublimetext.com/docs/2/revert.html
Revert to the clean state, and don’t forget to backup your current packages.

[origin posts]
My Sublime Text 2’s toggle comment feature is not working, also in line and in block.

I’m pretty sure it’s not because of the key binding overwriting, and I also disabled all packages not installed by default.

I can’t comment my code even by type the command “Toggle comment” directly, any help?

My environment is under Window 7 32 bit, with Sublime Text 2 2.0.1 Build 2217.

I’ll really appreciate for any help, thanks.

0 Likes

#2

Did you ignore to specify the file syntax that you want to toggle commet?

0 Likes

#3

No, I didn’t, the syntax highlight works well.

And I also noticed that I can’t search function names by pressing ctrl+shift+P and type starts with “@”, seems like I’m missing the syntax cache or something.

Someone just executed a batch file on this computer to clean the system temporary files few says ago, I think these all happens since then.

Is there anyway to made sublime rebuild the cache?

0 Likes

#4

Delete \Data\Cache folder.

0 Likes

#5

Excuse me, what does mean? The installation path?
My sublime_text.exe locates at D:\Program Files\Sublime Text 2, but I can’t find the directory “Data” under it.

0 Likes

#6

[quote=“nevermind”]Excuse me, what does mean? The installation path?
My sublime_text.exe locates at D:\Program Files\Sublime Text 2, but I can’t find the directory “Data” under it.[/quote]

For non-portable install, look in %APPDATA% and find a Sublime Text cache folder (Go to Start - Run - type in %APPDATA%)

0 Likes

#7

Hi, thanks for your response, here’s my directory content at the path you described.



As you can see, there’s no cache directory.
How can I fix it now?

0 Likes

#8

Did it just suddenly stop working (after whatever clean up process was run) or is it the first time you have opened a file of a particular type (you should probably specify that in this post also). I only ask this because the symbol list, as well as the comments I believe, are based on having the proper entries in the syntax file.

0 Likes

#9

Hi, skuroda.

If “suddenly stop working” means the Sublime Text shutdown unexpectedly, the answer is YES.
Sorry about not mentioning this, I supposed that Sublime Text will take care of it.

And I’m not open this particular file for the first time, the syntax highlight also works fine, I believes that means I got the right syntax file.

0 Likes

#10

Are there any errors in the console? You could also try reverting (sublimetext.com/docs/2/revert.html), if you haven’t already. You can do this first, just to make sure things are working properly, then move your custom stuff (plugins and user folder) back in). Of course, if you are using package control, you don’t really have to move plugins back either though right :smile:. Unless you manually installed them of course.

0 Likes

#11

It works! Thank you skuroda.
And thanks for everyone answered me!

0 Likes

#12

In: C:\Users\XXXXX\AppData\Roaming\Sublime Text 2\Packages\Default\Default (Windows).sublime-keymap

XXXXX = Your User’s name

Replace:

{ "keys": "ctrl+/"], "command": "toggle_comment", "args": { "block": false } }, { "keys": "ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },

to:

{ "keys": "ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } }, { "keys": "ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },

0 Likes