Sublime Forum

Parenthesis not working!?


I’m using sublime text 3 and I’m loving it so far.
However, now, all of a sudden, opening parenthesis ‘(’ does not work in python files!? It works fine with other file types.
I can write ‘)’ no problem, and ‘{’, ‘[’, ‘}’, ‘]’ works fine as well. it is just the ‘(’
I can also write a ‘(’ if I write it in a comment (e.g. # (hi)).

I’ve looked in the key-bindings and there is nothing wrongfully assigned to ‘shift + 8’

I’m on mac, using the following plugins: GitGutter, Jedi, Latexing and Anaconda.

I really hope you can help, it is so frustrating!
Thank you!



As a guess I would suspect one of the two python specific plugins you mentioned (Jedi and Anaconda), just based on your mention of how the key doesn’t work in python files specifically. You could verify that by disabling both plugins and seeing if the problem goes away or not. If it does, enable them again one at a time to see if the problem recurs.

Something that can often be helpful in this case is sublime’s ability to log commands as they are executed. You can open the Sublime console via Ctrl+` or View > Show Console and enter the command:

sublime.log_commands (True)

From that point forward (until you restart sublime or run the same command with False), every time sublime executes a command, its name will be displayed in the console. If you press the key that’s giving you trouble, what it displays may point at the culprit.

For example, the ( key usually generates a command of insert_snippet (if you have the appropriate option turned on), which causes it to insert both parts of the pair for you at once. If you use the Jedi autocompletion package, the same key executes the command sublime_jedi_params_autocomplete instead.



Thank you so much!
Logging the commands showed me the jedi command you described. Then simply disabling and re-enabling jedi solved the problem! :slightly_smiling:
Again, thank you!

1 Like


The reason this happens is that it is part of the default keymap in Jedi. Open Packages > Package Settings > Jedi > Keymap - Default and either comment out or remove the below section:

{"command": "sublime_jedi_params_autocomplete", "keys": ["("],
    "context": [
       {"key": "selector", "operator": "equal", "operand":  "source.python - string - comment"},
       {"key": "selection_empty", "operator": "equal", "operand": true, "match_all": true},
       {"key": "following_text", "operator": "regex_match", "operand": "^($| )", "match_all": true}

I’m just replying to provide the answer that lets you keep Jedi enabled, and just omit the offending keymap that causes the issue, in case others search for what causes this.