LanguageServer.jl
LanguageServer.jl copied to clipboard
Refactor Error Code definitions
This refactors the way error codes are handled, in preparation for making JSONRPC.jl less LSP specific, by hooking into custom error printing provided by an upstream PR. Requires https://github.com/julia-vscode/JSONRPC.jl/pull/70.
There's also these error codes that seem to overlap considerably:
https://github.com/julia-vscode/LanguageServer.jl/blob/e67befb27eb0783a7dcbef11eca8513d15e3a0a5/src/requests/features.jl#L155-L167
This error code is seemingly used for a formatting failure, but the LSP spec says this specific code should not be used:
/**
* This is the end range of JSON-RPC reserved error codes.
* It doesn't denote a real error code.
*
* @since 3.16.0
*/
export const jsonrpcReservedErrorRangeEnd = -32000;
This should probably be changed to some other error code, but I don't know how that would interact with the extension.
Similarly, this section also defines a new error code for formatting:
https://github.com/julia-vscode/LanguageServer.jl/blob/e67befb27eb0783a7dcbef11eca8513d15e3a0a5/src/requests/features.jl#L207-L217
This doesn't conflict with the spec, but it doesn't match the existing formatting error code used above. This needs a decision on whether they should be merged into one error code, or kept distinct.
Both of those should be -33000 I think. As far as I'm aware no-one is actually checking for the specific error code anyways, FWIW.