Skip to content

Commit 27cfadd

Browse files
committed
Incorporate PR feedback
Since this is basically the same errors, unify the two error codes into one. Technically the two are subtly different (one is trying to format the whole document, while the other is only trying to format a section), but the underlying cause is likely the same, so it's fine to merge them. If necessary/required, they can be disentangled later on too, as currently noone seems to check them anyway.
1 parent 53b4b84 commit 27cfadd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/LanguageServer.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const SERVER_CANCELLED = -32802
4141
const REQUEST_FAILED = -32803
4242

4343
# Specific to our implementation
44+
const FORMATTING_FAILED = -33000
4445
const NO_DOCUMENT = -33100
4546
const MISMATCHED_VERSION = -33101
4647
const SHUTDOWN_REQUEST = -32600
@@ -50,6 +51,7 @@ const ERROR_CODES = (
5051
CONTENT_MODIFIED,
5152
SERVER_CANCELLED,
5253
REQUEST_FAILED,
54+
FORMATTING_FAILED,
5355
NO_DOCUMENT,
5456
MISMATCHED_VERSION,
5557
SHUTDOWN_REQUEST

src/requests/features.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function textDocument_formatting_request(params::DocumentFormattingParams, serve
160160
format_text(get_text(doc), params, config)
161161
catch err
162162
return JSONRPC.JSONRPCError(
163-
-32000,
163+
FORMATTING_FAILED,
164164
"Failed to format document: $err.",
165165
nothing
166166
)
@@ -210,7 +210,7 @@ function textDocument_range_formatting_request(params::DocumentRangeFormattingPa
210210
format_text(text_marked, params, config)
211211
catch err
212212
return JSONRPC.JSONRPCError(
213-
-33000,
213+
FORMATTING_FAILED,
214214
"Failed to format document: $err.",
215215
nothing
216216
)

0 commit comments

Comments
 (0)