generated from itdominator/Python-With-Gtk-Template
Added config check guard
This commit is contained in:
parent
f49cca1ca9
commit
5280667789
@ -118,6 +118,19 @@ class LSPController:
|
||||
pylspclient.lsp_structs.Position(line, offset)
|
||||
)
|
||||
|
||||
def load_lsp_server(self, language_id):
|
||||
if not language_id in self.lsp_servers_config.keys():
|
||||
return
|
||||
|
||||
command = self.lsp_servers_config[language_id]["command"]
|
||||
config_options = self.lsp_servers_config[language_id]["initialization_options"]
|
||||
|
||||
if command:
|
||||
server_proc = self.create_lsp_server(command)
|
||||
if self.create_client(language_id, server_proc, config_options):
|
||||
return self.lsp_clients[language_id]
|
||||
|
||||
return None
|
||||
|
||||
def register_opened_file(self, language_id = "", uri = "", lsp_client = None):
|
||||
if not language_id or not uri: return
|
||||
@ -128,17 +141,3 @@ class LSPController:
|
||||
lsp_client.didOpen(
|
||||
pylspclient.lsp_structs.TextDocumentItem(uri, language_id, version, text)
|
||||
)
|
||||
|
||||
def load_lsp_server(self, language_id):
|
||||
command = self.lsp_servers_config[language_id]["command"]
|
||||
config_options = self.lsp_servers_config[language_id]["initialization_options"]
|
||||
if command:
|
||||
server_proc = self.create_lsp_server(command)
|
||||
client_created = self.create_client(language_id, server_proc, config_options)
|
||||
|
||||
if client_created:
|
||||
return self.lsp_clients[language_id]
|
||||
|
||||
text = f"LSP could not be created for file type: {language_id} ..."
|
||||
self._event_system.emit("bubble_message", ("warning", self.name, text,))
|
||||
return None
|
Loading…
Reference in New Issue
Block a user