microsoft / microsoft/vscode-languageserver-node
Passing arguments to vscode command in code action from non-js language server
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 404
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 14
Description
When a language server (implemented in OCaml) sends a code action with a command editor.action.goToLocations, it needs to pass various arguments to the command: uri, position, locations, multiple (optional), noResultsMessage (optional), and openInPeek (optional). From diving into implementation, I have several questions:
-
AFAIU,
uri,position,locationsshould be of format supported by vscode, e.g.,positionis not common position format forlsp:{line: number, character: number}BUT{lineNumber: number, column: number}. Shouldn't command arguments be more lsp friendly and support common to LSP format? -
More importantly, when I pass
uri, AFAIU, vscode has the following check for it (from here)
static isUri(thing: any): thing is URI {
if (thing instanceof URI) {
return true;
}
if (!thing) {
return false;
}
return typeof (<URI>thing).authority === 'string'
&& typeof (<URI>thing).fragment === 'string'
&& typeof (<URI>thing).path === 'string'
&& typeof (<URI>thing).query === 'string'
&& typeof (<URI>thing).scheme === 'string'
&& typeof (<URI>thing).fsPath === 'string'
&& typeof (<URI>thing).with === 'function'
&& typeof (<URI>thing).toString === 'function';
}
How does one send this json such that this returns true, taking into account with and toString properties?
I see there is some code that converts json to js objects, but it's minimalistic
I think that given vscode has a limited number of commands, the code could specialize handling of arguments to make it more friendly or there is some other easier way to go about this?
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 with client/src/common/codeConverter.ts around the referenced command conversion and compare it with the VS Code URI implementation linked in the issue. Trace how code-action command arguments cross the language-server boundary, including positions and URI values. Done should establish a supported representation or conversion approach for these arguments and clarify the expected behavior for optional parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml, typescript, vscode
- Domain
- api, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100