Merge pull request #17 from smathot/minor_fixes

Two minor fixes
This commit is contained in:
Yeger 2021-01-04 19:02:49 +02:00 committed by GitHub
commit fc6e645261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 18 deletions

View File

@ -5,7 +5,7 @@ from pylspclient import lsp_structs
class LspEndpoint(threading.Thread): class LspEndpoint(threading.Thread):
def __init__(self, json_rpc_endpoint, method_callbacks={}, notify_callbacks={}): def __init__(self, json_rpc_endpoint, method_callbacks={}, notify_callbacks={}, timeout=2):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.json_rpc_endpoint = json_rpc_endpoint self.json_rpc_endpoint = json_rpc_endpoint
self.notify_callbacks = notify_callbacks self.notify_callbacks = notify_callbacks
@ -13,6 +13,7 @@ class LspEndpoint(threading.Thread):
self.event_dict = {} self.event_dict = {}
self.response_dict = {} self.response_dict = {}
self.next_id = 0 self.next_id = 0
self._timeout = timeout
self.shutdown_flag = False self.shutdown_flag = False
@ -93,7 +94,8 @@ class LspEndpoint(threading.Thread):
if self.shutdown_flag: if self.shutdown_flag:
return None return None
cond.wait() if not cond.wait(timeout=self._timeout):
raise TimeoutError()
cond.release() cond.release()
self.event_dict.pop(current_id) self.event_dict.pop(current_id)

View File

@ -301,7 +301,7 @@ class SymbolInformation(object):
""" """
Represents information about programming constructs like variables, classes, interfaces etc. Represents information about programming constructs like variables, classes, interfaces etc.
""" """
def __init__(self, name, kind, location, containerName, deprecated=False): def __init__(self, name, kind, location, containerName=None, deprecated=False):
""" """
Constructs a new SymbolInformation instance. Constructs a new SymbolInformation instance.
@ -481,6 +481,34 @@ class CompletionItem(object):
self.score = score self.score = score
class CompletionItemKind(enum.Enum):
Text = 1
Method = 2
Function = 3
Constructor = 4
Field = 5
Variable = 6
Class = 7
Interface = 8
Module = 9
Property = 10
Unit = 11
Value = 12
Enum = 13
Keyword = 14
Snippet = 15
Color = 16
File = 17
Reference = 18
Folder = 19
EnumMember = 20
Constant = 21
Struct = 22
Event = 23
Operator = 24
TypeParameter = 25
class CompletionList(object): class CompletionList(object):
""" """
Represents a collection of [completion items](#CompletionItem) to be presented in the editor. Represents a collection of [completion items](#CompletionItem) to be presented in the editor.