Skip to content

Allow add-ons to register and execute commands - #4201

Open
pvcresin wants to merge 1 commit into
Shopify:mainfrom
pvcresin:allow-addon-commands
Open

Allow add-ons to register and execute commands#4201
pvcresin wants to merge 1 commit into
Shopify:mainfrom
pvcresin:allow-addon-commands

Conversation

@pvcresin

@pvcresin pvcresin commented Sep 6, 2026

Copy link
Copy Markdown

Motivation

Ruby LSP add-ons can contribute Code Lenses and other editor features, but there is currently no generic way for an add-on to register and handle the commands referenced by those features. This forces add-ons that need server-side command handling to provide additional editor integration.

Implementation

  • Add Addon#commands and Addon#execute_command hooks.
  • Register add-on commands through the standard client/registerCapability request after add-ons are loaded.
  • Handle the standard workspace/executeCommand request and route it to the add-on that owns the command.
  • Respect the client's workspace.executeCommand.dynamicRegistration capability and ignore errored add-ons.
  • Document the API and add protocol/server coverage.

Add-ons are loaded after the initialize response, so dynamic registration keeps the existing add-on lifecycle unchanged. The VS Code extension does not require changes because its existing vscode-languageclient dependency handles standard dynamic execute-command registration.

Automated Tests

  • test/requests/execute_command_test.rb
  • test/global_state_test.rb
  • Related Server, Addon, and Code Lens tests
  • RuboCop
  • Sorbet

Manual Tests

Not run in a full VS Code session. The new server tests verify the dynamic registration payload and command dispatch. An end-to-end test can be performed with an add-on that returns a command from commands, implements execute_command, and exposes a Code Lens using that command.

@pvcresin
pvcresin requested a review from a team as a code owner September 6, 2026 12:16
@pvcresin

pvcresin commented Sep 6, 2026

Copy link
Copy Markdown
Author

I have signed the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant