Sublime Forum

Comment // sudenly stop working

#1

Hello everyone,

For years I am doing some C++ using Sublime Text and everything worked fine.
But since yesterday, the comment line command is suddenly not working.
When I use the ctrl + / command I have the same behavior than the ctrl + m :
comment

The things I did to diagnostic the problem and try to fix it :

  • I tried the edit > comment > toggle comment and it is working as expected. So it seems to be a keybinding problem
  • I opened the keybindings (preferences > key bindings) and added:
    ,{ “keys”: [“ctrl+/”], “command”: “toggle_comment”, “args”: { “block”: false } }
    ,{ “keys”: [“ctrl+m”], “command”: “toggle_comment”, “args”: { “block”: true }

It is still not working as expected.
Do you have any ideas on what happended to me ? Some weird unwanted key combinations ? Some troubles with the sublime text update ?
It is very painful to not be able to comment lines with a shortcut :s

Thxs by advance for your answers !

0 Likes

#2

Did you upgrade to ST 4, downgrade to ST 3 or something?

0 Likes

#3

I do not remember if the upgrade to st 4 was at the same time.
Maybe it is the thing that triggered the problem.
But even if it is, It should have a way to fix it without downgrading.

0 Likes

#4
  • Is the syntax provided by built-in C++ package? (I mean, not provided by other plugins.)
  • Does the issue occur everywhere, or just in some particular places?
0 Likes

#5

It seems that it appears only for C++ files.
In Python projects, the comment line is working properly.

So maybe it is a problem with a plugin.
How can I have a look at the modification done by the plugins ?

0 Likes

#6

I would enable command logging via sublime.log_commands(True) in the console (ctrl+` on Windows). And then try ctrl+/ and ctrl+m to see what the console says.

0 Likes

#7

sublime.log_commands(True)
command: drag_select {“event”: {“button”: 1, “x”: 562.316711426, “y”: 274.616485596}}
command: git_gutter {“events”: 128}
command: git_gutter_blame {“is_event”: true, “line”: 26}
command: git_gutter {“action”: “blame”, “is_event”: true, “line”: 26}
command: toggle_comment {“block”: true}
command: git_gutter {“events”: 32}
command: drag_select {“event”: {“button”: 1, “x”: 315.844299316, “y”: 1255.69628906}}

0 Likes

#8

I only see one command: toggle_comment {“block”: true}

0 Likes

#9

yes but why “true” when I pressed ctrl + / ??

0 Likes

#10
  • Could you provide the path of the keybinding file that you edited?
  • Maybe also enable sublime.log_input(True) to see if ST thought you pressed ctrl+/ or not.
1 Like

#11

I found the solution from your last answer.
After log_input I saw that due to my french keyboard I was typing ctrl + shift + /
On the french keyboard not using the shift means typing " : ".
So ctrl + / in the keybindings file means ctrl + : on a french keyboard since the update.
I modified my keybindings and all is fine now.

Thanks for your help !

0 Likes