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