microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 235 forks source link

Plugin's typescript_format_brackets overrides Sublime's default unfold keybinding #753

Open nh2 opened 4 years ago

nh2 commented 4 years ago

Sublime's default keybindings

    { "keys": ["ctrl+shift+["], "command": "fold" },
    { "keys": ["ctrl+shift+]"], "command": "unfold" },

fold and unfold code, like this:

image

In https://github.com/microsoft/TypeScript-Sublime-Plugin/blob/a0d393af5714af3ea417239efce22c4db647502b/Default.sublime-keymap#L173-L174

the TypeScript plugin overrides the unfold, so you can no longer unfold code after folding it.

Does it make sense to override a default keybinding this way?

LetsZiggy commented 4 years ago

@nh2 , I manage to change the keybinding based on this reference

In my Default (Linux).sublime-keymap

[
  ...
  // Reimplement default
  {
    "keys": ["ctrl+shift+["],
    "command": "fold" 
  },
  {
    "keys": ["ctrl+shift+]"],
    "command": "unfold"
  },
  ...

  ...
  // Rebind default typescript key binding
  {
    "keys": ["ctrl+shift+\\"],
    "command": "typescript_format_brackets",
    "context": [
      { "key": "selector", "operator": "equal", "operand": "source.ts, source.tsx, source.js, source.jsx" }
    ]
  },
  ...
]