fixed id updates; improved result checking

This commit is contained in:
itdominator 2024-09-20 00:59:35 -05:00
parent 28b618ea0b
commit d972b93b64
2 changed files with 16 additions and 12 deletions

View File

@ -38,7 +38,7 @@ class EditorControllerMixin(KeyInputController, EditorEventsMixin):
if action == "set_buffer_style":
self.set_buffer_style(source_view, query)
def _handle_lsp_message(self, message: dict or LSPResponseTypes):
def _handle_lsp_message(self, message: dict or LSPResponseType):
if not self.is_editor_focused: return # TODO: Find way to converge this
page_num, container, source_view = self.get_active_view()
page_num = None
@ -50,18 +50,22 @@ class EditorControllerMixin(KeyInputController, EditorEventsMixin):
...
if hasattr(message, "result"):
keys = message.result.keys()
if message.result is dict:
keys = message.result.keys()
if "items" in keys:
completion = source_view.get_completion()
providers = completion.get_providers()
if "items" in keys:
completion = source_view.get_completion()
providers = completion.get_providers()
for provider in providers:
if provider.__class__.__name__ == 'LSPCompletionProvider':
source_view.completion_items = message.result["items"]
source_view.emit("show-completion")
for provider in providers:
if provider.__class__.__name__ == 'LSPCompletionProvider':
source_view.completion_items = message.result["items"]
source_view.emit("show-completion")
if "result" in keys:
if "result" in keys:
...
if message.result is list:
...
if hasattr(message, "method"):

View File

@ -26,11 +26,11 @@ class SourceViewEvents(SourceViewDnDMixin, MarkEventsMixin, FileEventsMixin):
if not self._loading_file:
buffer.version_id = self._version_id
self._version_id += 1
event_system.emit("buffer_changed", (buffer, ))
event_system.emit("textDocument/didChange", (file_type, self.get_current_file().get_uri(), buffer, ))
self._version_id += 1
# event_system.emit("textDocument/completion", (self, ))
self.update_cursor_position(buffer)