Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keybinding: support more complex when-conditions #38972

Closed
SailorMax opened this issue Nov 22, 2017 · 4 comments
Closed

keybinding: support more complex when-conditions #38972

SailorMax opened this issue Nov 22, 2017 · 4 comments
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality keybindings VS Code keybinding issues
Milestone

Comments

@SailorMax
Copy link

SailorMax commented Nov 22, 2017

  • VSCode Version: 1.18.1
  • OS Version: Windows 10

Can you add support more complex when-conditions. Sample:

// Place your key bindings in this file to overwrite the defaults
[
	{
        	"key": "ctrl+]",
	        "command": "editor.action.jumpToBracket",
	        "when": "editorTextFocus"
	},
	{
		"key": "ctrl+]",
		"command": "editor.emmet.action.matchTag",
		"when": "editorTextFocus && (editorLangId == html || editorLangId == xml)"
	}
]

same hotkey for different file types exec different commands

Currently VSCode support only simple "&&". Second hotkey doesn't work. And we have to write:

// Place your key bindings in this file to overwrite the defaults
[
	{
        	"key": "ctrl+]",
	        "command": "editor.action.jumpToBracket",
	        "when": "editorTextFocus"
	},
	{
		"key": "ctrl+]",
		"command": "editor.emmet.action.matchTag",
		"when": "editorTextFocus && editorLangId == html"
	},
	{
		"key": "ctrl+]",
		"command": "editor.emmet.action.matchTag",
		"when": "editorTextFocus && editorLangId == xml"
	}
]
@vscodebot vscodebot bot added the emmet Emmet related issues label Nov 22, 2017
@ramya-rao-a ramya-rao-a added keybindings VS Code keybinding issues and removed emmet Emmet related issues labels Nov 24, 2017
@ramya-rao-a ramya-rao-a removed their assignment Nov 24, 2017
@alexdima alexdima added the feature-request Request for new features or functionality label Nov 27, 2017
@alexdima alexdima added this to the Backlog milestone Nov 27, 2017
@alexdima alexdima removed their assignment Nov 27, 2017
@jVanZwieten
Copy link

As well, it would be nice to use != for example:

"when": "editorTextFocus && suggestWidgetVisible && editorLangID != json"

@NightMachinery
Copy link

Dup of #91473 ?

@usernamehw
Copy link
Contributor

/duplicate of #91473

@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality keybindings VS Code keybinding issues
Projects
None yet
Development

No branches or pull requests

7 participants
@alexdima @SailorMax @usernamehw @jVanZwieten @ramya-rao-a @NightMachinery and others