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

onDidExecuteCommand listener running twice for single command #78274

Closed
alexr00 opened this issue Jul 31, 2019 · 4 comments
Closed

onDidExecuteCommand listener running twice for single command #78274

alexr00 opened this issue Jul 31, 2019 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@alexr00
Copy link
Member

alexr00 commented Jul 31, 2019

This is the only way I've been able to repro this issue. I started with the hello world extension sample and modified the the activate:

export function activate(context: vscode.ExtensionContext) {
	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "helloworld-sample" is now active!');

	// The command has been defined in the package.json file
	// Now provide the implementation of the command with registerCommand
	// The commandId parameter must match the command field in package.json
	const disposables: vscode.Disposable[] = [];
	disposables.push(vscode.commands.registerCommand('extension.helloWorld', () => {
		// The code you place here will be executed every time your command is executed

		// Display a message box to the user
		vscode.window.showInformationMessage('Hello World!');
	}));

	disposables.push(vscode.commands.onDidExecuteCommand((e: vscode.CommandExecutionEvent) => {
		console.log(e.command);
	}));

	context.subscriptions.push(...disposables);
}

The command isn't actually running twice, but the listener for onDidExecuteCommand does get called twice.

@jrieken
Copy link
Member

jrieken commented Jul 31, 2019

This is the only way I've been able to repro this issue.

What does that mean? It doesn't happen for other commands?

@jrieken jrieken added this to the July 2019 milestone Jul 31, 2019
@alexr00
Copy link
Member Author

alexr00 commented Jul 31, 2019

Correct, it doesn't happen for other commands.

@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Jul 31, 2019
@jrieken
Copy link
Member

jrieken commented Jul 31, 2019

I can repo. Seems to happen with commands that are registered on the extension host side and then triggered from the main side

@alexr00
Copy link
Member Author

alexr00 commented Jul 31, 2019

Verified out of source.

@alexr00 alexr00 added the verified Verification succeeded label Jul 31, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants