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, locations should be of format supported by vscode, e.g., position is not common position format for lsp: {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?
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), andopenInPeek(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)How does one send this json such that this returns true, taking into account
withandtoStringproperties?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?