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

"setContext" Command Does Not Work #9338

Closed
TomHermanSAP opened this issue Apr 13, 2021 · 0 comments · Fixed by #9343
Closed

"setContext" Command Does Not Work #9338

TomHermanSAP opened this issue Apr 13, 2021 · 0 comments · Fixed by #9343
Labels
help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility

Comments

@TomHermanSAP
Copy link

Bug Description:

A command should be exposed in the command palette based on a custom variable set with setContext.

Although I set the value of the custom variable to true, the command is not available from the command palette.

Important Observation:

Attached is an example of a "Hello World" extension (Change its suffix from zip to vsix):
helloworld-sample-set-context-0.0.1.zip

The command Hello World is not available in the command palette .

package.json:

    "contributes": {
        "commands": [
            {
                "command": "extension.helloWorld",
                "title": "Hello World"
            }
        ],
        "menus": {
            "commandPalette": [
                {
                    "when": "tom",
                    "command": "extension.helloWorld"
                }
            ]
        }
    }

extension.ts:

import * as vscode from 'vscode';

export async function activate(context: vscode.ExtensionContext) {
	await vscode.commands.executeCommand("setContext", "tom", true);

	const disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
		vscode.window.showInformationMessage('Hello World!');
	});
	context.subscriptions.push(disposable);
}

Steps to Reproduce:

  1. git clone Theia's repository.
  2. Download the .vsix file attached and copy it into the plugins directory under Theia's repository.
  3. In Terminal of root directory of Theia's repository: yarn; yarn start:browser.
  4. Open localhost:3000 in browser.
  5. Try to find the command Hello World in the command palette.
  6. The command Hello World is not available from the command palette.(!)

Additional Information

  • Operating System: Windows 10
  • Theia Version: master.
@vince-fugnitto vince-fugnitto added help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility labels Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted issues meant to be picked up, require help vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants