Adding support for VSCode command suffix's per extension#588
Open
vzhan00 wants to merge 1 commit into
Open
Conversation
satyakigh
reviewed
May 27, 2026
| staticInitialize(params.clientInfo, params.initializationOptions?.['aws']); | ||
|
|
||
| const name = params.initializationOptions?.aws?.clientInfo?.extension?.name; | ||
| const suffix = typeof name === 'string' ? name : undefined; |
Collaborator
There was a problem hiding this comment.
We should only allow this if its a string, otherwise throw
| import { TelemetryService } from '../telemetry/TelemetryService'; | ||
| import { getRegion } from '../utils/Region'; | ||
|
|
||
| export const CLEAR_DIAGNOSTIC = '/command/template/clear-diagnostic'; |
Collaborator
There was a problem hiding this comment.
Instead of this singleton pattern, can the suffix be used to directly create LspCapabilities + LspConnection. Then just send the capabilities which has the set of commands directly to CfnServer creation and pass the commands down to execution handler and code action handler?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
Fixes duplicate command registration crash when multiple VS Code extensions (e.g., AWS Toolkit and CloudFormation standalone) run the same language server simultaneously.
Problem: vscode-languageclient registers commands from executeCommandProvider in VS Code's global command registry, which doesn't allow duplicates. The second extension to activate crashes with Error: command '/command/template/clear-diagnostic' already exists.
Fix: The server now derives a unique command suffix from initializationOptions.aws.clientInfo.extension.name (already sent by all clients). Each client gets uniquely-suffixed commands (e.g., /command/template/clear-diagnostic.aws.cloudformation), eliminating the collision.
Changes:
Backward compatible: If no extension name is provided, commands remain unsuffixed (original behavior). Currently since we're using the extension name, the existing toolkit suffix will be
amazonwebservices.aws-toolkit-vscodeand for the standalone it will beaws.cloudformation.Testing:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.