Skip to content

Duplicate commands registered #3320

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

Closed
Charles-Gagnon opened this issue Apr 28, 2021 · 4 comments · Fixed by #3329
Closed

Duplicate commands registered #3320

Charles-Gagnon opened this issue Apr 28, 2021 · 4 comments · Fixed by #3329
Assignees
Labels
Area-UI Issue-Bug A bug to squash.

Comments

@Charles-Gagnon
Copy link

Upon startup see these errors in the log :

[ms-vscode.powershell]: Command `workbench.action.positionPanelLeft` appears multiple times in the `commands` section.
[ms-vscode.powershell]: Command `workbench.action.positionPanelBottom` appears multiple times in the `commands` section.

The reason for this is because you define the commands here : https://github.com/PowerShell/vscode-powershell/blob/master/package.json#L285

using the command IDs workbench.action.positionPanelLeft and workbench.action.positionPanelBottom. But these are the command IDs used by VS Code : https://github.com/microsoft/vscode/blob/main/src/vs/workbench/browser/parts/panel/panelActions.ts#L100

so it sees that there's duplicate commands and throws the error (which admittedly isn't actually accurate in this case).

Given that it doesn't seem like you actually try to define this action in your extension currently these commands should be removed from your package.json since currently they aren't actually doing anything. (or given a different command ID and then just have that command call the workbench one if you still want this to show up in the contributions section of the gallery)

@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 28, 2021
@andyleejordan andyleejordan added this to the Committed-vNext milestone Apr 28, 2021
@andyleejordan andyleejordan self-assigned this Apr 28, 2021
@andyleejordan andyleejordan added Area-UI Issue-Bug A bug to squash. labels Apr 28, 2021
@MartinGC94
Copy link
Contributor

I added that while knowing nothing about how VS code extensions work so I'm not too surprised I made a mistake. What's the correct way to do this? The purpose of my change was to add buttons for those built-in actions because people who are used to ISE are used to having buttons for moving the console around.

@Charles-Gagnon
Copy link
Author

You can just make your own command and then register it which just calls the built-in command.

So you'd define powershell.action.positionPanelLeft and then in your extension activation call

            vscode.commands.registerCommand(
                'powershell.action.positionPanelLeft',
                async () => { await vscode.commands.executeCommand('workbench.action.positionPanelLeft'); }),

@andyleejordan
Copy link
Member

@MartinGC94 Do you want to fix this? That'd be awesome. It was on my to-do list but not something I was going to get to today. I can assign to you if you'd like 😁

@MartinGC94
Copy link
Contributor

@andschwa sure although I probably won't look at it today either.

@andyleejordan andyleejordan removed the Needs: Triage Maintainer attention needed! label Apr 30, 2021
andyleejordan pushed a commit that referenced this issue May 3, 2021
Fixes #3320 by adding extension commands that call the built-in commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UI Issue-Bug A bug to squash.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants