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": if action == "set_buffer_style":
self.set_buffer_style(source_view, query) 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 if not self.is_editor_focused: return # TODO: Find way to converge this
page_num, container, source_view = self.get_active_view() page_num, container, source_view = self.get_active_view()
page_num = None page_num = None
@ -50,6 +50,7 @@ class EditorControllerMixin(KeyInputController, EditorEventsMixin):
... ...
if hasattr(message, "result"): if hasattr(message, "result"):
if message.result is dict:
keys = message.result.keys() keys = message.result.keys()
if "items" in keys: if "items" in keys:
@ -64,6 +65,9 @@ class EditorControllerMixin(KeyInputController, EditorEventsMixin):
if "result" in keys: if "result" in keys:
... ...
if message.result is list:
...
if hasattr(message, "method"): if hasattr(message, "method"):
if message.method == "textDocument/publshDiagnostics": if message.method == "textDocument/publshDiagnostics":
... ...

View File

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