From 880c4839ccb849d8fb69503c8f8461f9f2eb4f12 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Wed, 17 Jan 2024 12:25:52 -0600 Subject: [PATCH] Text change track; workspaceb detrack temporary --- plugins/lsp_client/lsp_controller.py | 11 +++++++---- plugins/lsp_client/plugin.py | 13 ++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugins/lsp_client/lsp_controller.py b/plugins/lsp_client/lsp_controller.py index 720f15b..ee49d9d 100644 --- a/plugins/lsp_client/lsp_controller.py +++ b/plugins/lsp_client/lsp_controller.py @@ -21,7 +21,6 @@ class ReadPipe(threading.Thread): line = self.pipe.readline().decode('utf-8') - class LSPController: def __init__(self, lsp_servers_config = {}): super().__init__() @@ -29,6 +28,7 @@ class LSPController: self.lsp_servers_config = lsp_servers_config self.lsp_clients = {} + def _blame(self, response): for d in response['diagnostics']: if d['severity'] == 1: @@ -63,8 +63,10 @@ class LSPController: if not language or not server_proc: return False root_path = None - root_uri = 'file:///home/abaddon/Coding/Projects/Active/C_n_CPP_Projects/gtk/Newton/src/' - workspace_folders = [{'name': 'python-lsp', 'uri': root_uri}] + # root_uri = 'file:///home/abaddon/Coding/Projects/Active/C_n_CPP_Projects/gtk/Newton/src/' + # workspace_folders = [{'name': 'python-lsp', 'uri': root_uri}] + root_uri = '' + workspace_folders = [{'name': '', 'uri': root_uri}] lsp_client = self._generate_client(language, server_proc) lsp_client.initialize( @@ -148,7 +150,8 @@ class LSPController: return self.lsp_clients[language_id].completion( pylspclient.lsp_structs.TextDocumentIdentifier(uri), pylspclient.lsp_structs.Position(line, offset), - pylspclient.lsp_structs.CompletionContext(trigger, _char) + None + # pylspclient.lsp_structs.CompletionContext(trigger, _char) ) return [] diff --git a/plugins/lsp_client/plugin.py b/plugins/lsp_client/plugin.py index 11f2954..494741c 100644 --- a/plugins/lsp_client/plugin.py +++ b/plugins/lsp_client/plugin.py @@ -53,7 +53,7 @@ class Plugin(PluginBase): def inner_subscribe_to_events(self): self._event_system.subscribe("shutting_down", self._shutting_down) - self._event_system.subscribe("textDocument/didChange", self._buffer_changed) + # self._event_system.subscribe("textDocument/didChange", self._buffer_changed) self._event_system.subscribe("textDocument/didOpen", self.lsp_controller.do_open) self._event_system.subscribe("textDocument/didSave", self.lsp_controller.do_save) self._event_system.subscribe("textDocument/didClose", self.lsp_controller.do_close) @@ -88,15 +88,13 @@ class Plugin(PluginBase): text = buffer.get_text(start, end, include_hidden_chars = False) result = self.lsp_controller.do_change(language_id, line, start, end, text) - # print(result) - def completion(self, source_view, context, callback): self.cancel_timer() self.delay_completion(source_view, context, callback) def _do_completion(self, source_view, context, callback): - filepath = source_view.get_current_file() + filepath = source_view.get_current_file() if not filepath: return @@ -106,10 +104,11 @@ class Plugin(PluginBase): line = iter.get_line() + 1 _char = iter.get_char() - if iter.backward_char(): - _char = iter.get_char() + # if iter.backward_char(): + # _char = iter.get_char() - offset = iter.get_line_offset() + offset = iter.get_line_index() + 1 + # offset = iter.get_line_offset() result = self.lsp_controller.do_completion(source_view.get_filetype(), uri, line, offset, _char) callback(context, result)