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

"when" clause for every sub-command #32

Open
shotexa opened this issue Dec 21, 2020 · 3 comments
Open

"when" clause for every sub-command #32

shotexa opened this issue Dec 21, 2020 · 3 comments

Comments

@shotexa
Copy link

shotexa commented Dec 21, 2020

I'd like to supply a "when" clause for every sub-command, as shown in this example:

 "multiCommand.commands": [
        {
            "command": "multiCommand.formatDocument",
            "sequence": [
                {
                    "command": "editor.action.formatDocument",
                },
                {
                    "command": "editor.action.organizeImports",
                    "when": "!activeEditorIsDirty"
                }
            ]
        }
  ]

When I tried to do it, the extension just ignores the "when" clause but works otherwise. Am I doing it wrong? or is it just not supported right now?

@ryuta46
Copy link
Owner

ryuta46 commented Jan 23, 2021

I really wanted to implement this kind of feature and investigated before, but I couldn't find a way to get current context from an extension.
#3 (comment)

Please somehow use "when" in the keybindings.json now.

@finnmerlett
Copy link

does this comment offer a way to implement this now? microsoft/vscode#10471 (comment)

@ryuta46
Copy link
Owner

ryuta46 commented Jul 20, 2024

I’ve read the comment and the referred document, but I think the solution is only related a context menu in a webview. I’m afraid the solution is not the alternative way of getting the current context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants