Let’s say I have this in my Default (Linux).sublime-mousemap
:
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
},
It binds ctrl+mouse button 1 to Go To Definition. However, for languages supported by the Language Server Plugin eg. Rust, the command is not goto_definition
but lsp_symbol_definition
. So I tried adding another, context-specific mouse binding:
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "goto_definition"
},
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
"command": "lsp_symbol_definition",
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.rust" }
]
},
However now the Rust-specific one works, but the more general one does not. I would have assumed that if the specific context for a binding doesn’t match, the more general one that does match would work. (There’s no documentation for mouse bindings like there is for key bindings to confirm that, though.)
Is there a way to have this kind of syntax-specific mouse binding that doesn’t override the one without a context?