File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 10
10
from jsonrpc .exceptions import JSONRPCMethodNotFound , JSONRPCDispatchException , JSONRPCServerError
11
11
12
12
log = logging .getLogger (__name__ )
13
-
14
13
RESPONSE_CLASS_MAP = {
15
14
"1.0" : JSONRPC10Response ,
16
15
"2.0" : JSONRPC20Response
17
16
}
17
+ # as defined in https://github.com/Microsoft/language-server-protocol/blob/gh-pages/specification.md
18
+ LSP_CANCEL_CODE = - 32800
18
19
19
20
20
21
class MissingMethodException (Exception ):
@@ -83,7 +84,9 @@ def cancel(self, request_id):
83
84
"""
84
85
log .debug ('Cancel request %d' , request_id )
85
86
try :
86
- self ._received_requests [request_id ].cancel ()
87
+ self ._received_requests [request_id ].set_exception (
88
+ JSONRPCDispatchException (code = LSP_CANCEL_CODE , message = "Request cancelled" )
89
+ )
87
90
except KeyError :
88
91
log .debug ('Received cancel for finished/nonexistent request %d' , request_id )
89
92
You can’t perform that action at this time.
0 commit comments