microsoft / microsoft/language-server-protocol
Execute client side command
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 1k
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 10
Description
We are providing some code actions, and some of them should be invoked on client side (like opening a new panel to display some guidelines about diagnostics).
The official workflow specified with protocol v3 is:
- client invokes
textDocument/codeAction - server returns an array of Command
- user picks one command
- client invokes
workspace/executeCommand
So we end up on LS side, with no way to invoke a command on client side.
VSCode has a specific behavior. If a returned Command matches a command declared on VSCode side, it will not call workspace/executeCommand but instead directly invoke the client side command.
I find this very convenient, but this is not what is defined in protocol V3, and consequently not portable (Atom doesn't work like this for example, see https://github.com/atom/atom-languageclient/issues/183).
Proposals:
- officially support this behavior, but this maybe a bit too "magic" (what if client doesn't have a concept of command? can the LS be sure the command exists on client side?)
- add a new
executeCommandoperation, in the direction LS -> client, allowing a server to explicitly request a client to execute a command (with proper capability declaration, error handling, ...) - to avoid extra round trip, maybe add a flag on the Command returned by
textDocument/codeActionto precise if this is a client side or a server side command
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the protocol v3 code-action and workspace/executeCommand definitions, then compare the VSCode behavior described here with the Atom language client issue. The issue presents several competing proposals rather than a settled change. Done would require an agreed, portable client-side command mechanism with capability declaration and error handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- api, backend-api-design, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100