11.08., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 5c48da22 authored by di68kap's avatar di68kap

- server.py: language server started

parent c29315c8
......@@ -342,6 +342,12 @@ class Server:
params = obj['params'] if 'params' in obj else ()
await run(method_name, method, params)
error = cast(Dict[str, str], result['error'])
rpc_error = error['code'], error['message']
except TypeError:
pass # result is not a dictionary, never mind
if rpc_error is None:
json_result = {"jsonrpc": "2.0", "result": result, "id": json_id}
writer.write(json.dumps(json_result, cls=DHParser_JSONEncoder).encode())
......@@ -456,3 +462,34 @@ class Server:
while self.server_messages.get() != SERVER_OFFLINE:
class LanguageServer(Server):
"""Template for the implementation of a language server.
See: https://microsoft.github.io/language-server-protocol/"""
cpu_bound = ALL_RPCs # type: Set[str]
blocking = frozenset() # type: Set[str]
def __init__(self):
rpc_table = dict() # type: RPC_Table
for attr in dir(self):
if attr.startswith('rpc_'):
name = attr[4:].replace('_', '/')
func = getattr(self, attr)
rpc_table[name] = func
super().__init__(rpc_table, self.cpu_bound, self.blocking)
self._initialized = False
def rpc_initialize(self,
processId: Optional[int],
rootPath: Optional[str],
rootUri: Optional[str],
initializeOptions: JSON_Type,
capabilities: JSON_Type,
trace: str,
workspaceFolders: List[Dict[str, str]]):
if self._initialized:
# Error Code -32002
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment