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

Test: Add in operator support to when clauses #105777

Closed
2 tasks done
eamodio opened this issue Aug 31, 2020 · 1 comment
Closed
2 tasks done

Test: Add in operator support to when clauses #105777

eamodio opened this issue Aug 31, 2020 · 1 comment

Comments

@eamodio
Copy link
Contributor

eamodio commented Aug 31, 2020

Refs: #97544

Complexity: 4

Create Issue


Create a simple extension that optionally shows a command depending on if 1 context key's value exists in another context key's value.

Example 1

vscode.executeCommand('setContext', 'supportedFolders', [ 'test', 'foo', 'bar' ]);

// or

vscode.executeCommand('setContext', 'supportedFileExtensions', { 'test': true, 'foo': 'anything', 'bar': false });

NOTE: in the object case, the value doesn't matter, as it is just the existence of the key on the object

"menus": {
	"explorer/context": [
		{
			"command": "ext.showOnlyOnCertainFolders",
                        "when": "explorerResourceIsFolder && resourceFilename in supportedFolders"
		}
	]
}

Example 2

vscode.executeCommand('setContext', 'supportedFileExtensions', [ '.js', '.ts' ]);

// or

vscode.executeCommand('setContext', 'supportedFileExtensions', { '.js': true, '.ts': 'anything' });

NOTE: in the object case, the value doesn't matter, as it is just the existence of the key on the object

"menus": {
	"explorer/context": [
		{
			"command": "ext.showOnlyOnCertainFiles",
                        "when": "!explorerResourceIsFolder && resourceExtname in supportedFileExtensions"
		}
	]
}
@bpasero
Copy link
Member

bpasero commented Sep 1, 2020

Pretty cool 👍

@alexr00 alexr00 removed their assignment Sep 1, 2020
@alexr00 alexr00 closed this as completed Sep 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants