File tree 3 files changed +28
-2
lines changed
3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -95,3 +95,21 @@ class TextDocumentSyncKind:
95
95
class NotebookCellKind :
96
96
Markup = 1
97
97
Code = 2
98
+
99
+
100
+ # https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#errorCodes
101
+ class ErrorCodes :
102
+ ParseError = - 32700
103
+ InvalidRequest = - 32600
104
+ MethodNotFound = - 32601
105
+ InvalidParams = - 32602
106
+ InternalError = - 32603
107
+ jsonrpcReservedErrorRangeStart = - 32099
108
+ ServerNotInitialized = - 32002
109
+ UnknownErrorCode = - 32001
110
+ jsonrpcReservedErrorRangeEnd = - 32000
111
+ lspReservedErrorRangeStart = - 32899
112
+ ServerCancelled = - 32802
113
+ ContentModified = - 32801
114
+ RequestCancelled = - 32800
115
+ lspReservedErrorRangeEnd = - 32800
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ def __getitem__(self, item):
215
215
if self ._shutdown and item != "exit" :
216
216
# exit is the only allowed method during shutdown
217
217
log .debug ("Ignoring non-exit method during shutdown: %s" , item )
218
- raise KeyError
218
+ item = "invalid_request_after_shutdown"
219
219
220
220
try :
221
221
return super ().__getitem__ (item )
@@ -234,6 +234,14 @@ def m_shutdown(self, **_kwargs):
234
234
workspace .close ()
235
235
self ._shutdown = True
236
236
237
+ def m_invalid_request_after_shutdown (self , ** _kwargs ):
238
+ return {
239
+ "error" : {
240
+ "code" : lsp .ErrorCodes .InvalidRequest ,
241
+ "message" : "Requests after shutdown are not valid" ,
242
+ }
243
+ }
244
+
237
245
def m_exit (self , ** _kwargs ):
238
246
self ._endpoint .shutdown ()
239
247
if self ._jsonrpc_stream_reader is not None :
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ dependencies = [
17
17
" importlib_metadata>=4.8.3;python_version<\" 3.10\" " ,
18
18
" jedi>=0.17.2,<0.20.0" ,
19
19
" pluggy>=1.0.0" ,
20
- " python-lsp-jsonrpc>=1.0.0" ,
20
+ " python-lsp-jsonrpc>=1.1.0,<2. 0.0" ,
21
21
" ujson>=3.0.0" ,
22
22
]
23
23
dynamic = [" version" ]
You can’t perform that action at this time.
0 commit comments