So the problem is to assign this to Escape without overriding any other functionality. I've tried the following, but it doesn't work.
{
"keys": ["escape"],
"command": "exec",
"args": {"hide_phantoms_only" : true },
"context": [ { "key": "phantom_visible", "operator": "equal", "operand": true }],
},
I haven't found any documentation on which context keys exist, so phantom_visible
was just a guess.
Unfortunately, at the moment Sublime Text (at the time of writing, build 3126) does not have a context that you can use in a keybinding to tell when inline build error phantoms are shown. This has been briefly discussed in the ST forums so it is possible that a future build will contain this functionality.
In the meantime, inspired by this post, we could potentially try to create a keybinding that won't conflict with the default Esc behavior. But it's worth bearing in mind that the default keybindings may change so we will need to watch for it when updating ST, to see whether this is still relevant/correctly covers all scenarios:
{ "keys": ["escape"], "command": "exec", "args": { "hide_phantoms_only": true },
"context":
[
// inverse of all the "escape" key contexts found in the Default keybindings
{ "key": "num_selections", "operator": "equal", "operand": 1 },
{ "key": "has_next_field", "operator": "equal", "operand": false },
{ "key": "has_prev_field", "operator": "equal", "operand": false },
{ "key": "panel_visible", "operator": "equal", "operand": false },
{ "key": "overlay_visible", "operator": "equal", "operand": false },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With