diff --git a/src/LanguageServer.jl b/src/LanguageServer.jl index a7a4361bf..f9a35a30a 100644 --- a/src/LanguageServer.jl +++ b/src/LanguageServer.jl @@ -41,6 +41,7 @@ const SERVER_CANCELLED = -32802 const REQUEST_FAILED = -32803 # Specific to our implementation +const FORMATTING_FAILED = -33000 const NO_DOCUMENT = -33100 const MISMATCHED_VERSION = -33101 const SHUTDOWN_REQUEST = -32600 @@ -50,6 +51,7 @@ const ERROR_CODES = ( CONTENT_MODIFIED, SERVER_CANCELLED, REQUEST_FAILED, + FORMATTING_FAILED, NO_DOCUMENT, MISMATCHED_VERSION, SHUTDOWN_REQUEST diff --git a/src/requests/features.jl b/src/requests/features.jl index 9d232b64d..0652ec578 100644 --- a/src/requests/features.jl +++ b/src/requests/features.jl @@ -160,7 +160,7 @@ function textDocument_formatting_request(params::DocumentFormattingParams, serve format_text(get_text(doc), params, config) catch err return JSONRPC.JSONRPCError( - -32000, + FORMATTING_FAILED, "Failed to format document: $err.", nothing ) @@ -210,7 +210,7 @@ function textDocument_range_formatting_request(params::DocumentRangeFormattingPa format_text(text_marked, params, config) catch err return JSONRPC.JSONRPCError( - -33000, + FORMATTING_FAILED, "Failed to format document: $err.", nothing )