Text change track; workspaceb detrack temporary

This commit is contained in:
itdominator 2024-01-17 12:25:52 -06:00
parent 0e8833f6f9
commit 880c4839cc
2 changed files with 13 additions and 11 deletions

View File

@ -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 []

View File

@ -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)