generated from itdominator/Python-With-Gtk-Template
Initial wiring of lsp manager calls and responses
This commit is contained in:
parent
9836285f86
commit
07a0316703
|
@ -3,6 +3,7 @@
|
|||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from libs.dto.lsp_message_structs import LSPResponseTypes, LSPResponseRequest, LSPResponseNotification
|
||||
from .key_input_controller import KeyInputController
|
||||
from .editor_events import EditorEventsMixin
|
||||
|
||||
|
@ -30,4 +31,12 @@ class EditorControllerMixin(KeyInputController, EditorEventsMixin):
|
|||
if action == "set_buffer_language":
|
||||
self.set_buffer_language(source_view, query)
|
||||
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):
|
||||
if isinstance(message, dict):
|
||||
...
|
||||
if isinstance(message, LSPResponseRequest):
|
||||
...
|
||||
if isinstance(message, LSPResponseNotification):
|
||||
...
|
||||
|
|
|
@ -58,6 +58,8 @@ class EditorNotebook(EditorControllerMixin, Gtk.Notebook):
|
|||
self.connect("key-release-event", self._key_release_event)
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe("handle-lsp-message", self._handle_lsp_message)
|
||||
|
||||
event_system.subscribe("create_view", self._create_view)
|
||||
event_system.subscribe("set_buffer_style", self.action_controller)
|
||||
event_system.subscribe("set_buffer_language", self.action_controller)
|
||||
|
@ -140,4 +142,4 @@ class EditorNotebook(EditorControllerMixin, Gtk.Notebook):
|
|||
self.action_controller("scale_up_text")
|
||||
|
||||
def _keyboard_scale_down_text(self):
|
||||
self.action_controller("scale_down_text")
|
||||
self.action_controller("scale_down_text")
|
||||
|
|
|
@ -26,7 +26,7 @@ class SourceViewEvents(SourceViewDnDMixin, MarkEventsMixin, FileEventsMixin):
|
|||
|
||||
if not self._loading_file:
|
||||
event_system.emit("buffer_changed", (buffer, ))
|
||||
event_system.emit("textDocument/didChange", (file_type, buffer, ))
|
||||
event_system.emit("textDocument/didChange", (file_type, self.get_current_file().get_uri(), buffer, ))
|
||||
event_system.emit("textDocument/completion", (self, ))
|
||||
|
||||
self.update_cursor_position(buffer)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
"""
|
||||
Dasta Class module
|
||||
"""
|
|
@ -0,0 +1,41 @@
|
|||
# Python imports
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
def get_message_obj(data: str):
|
||||
return json.loads(data)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LSPResponseRequest(object):
|
||||
"""
|
||||
Constructs a new LSP Response Request instance.
|
||||
|
||||
:param id result: The id of the given message.
|
||||
:param dict result: The arguments of the given method.
|
||||
"""
|
||||
jsonrpc: str
|
||||
id: int
|
||||
result: dict
|
||||
|
||||
@dataclass
|
||||
class LSPResponseNotification(object):
|
||||
"""
|
||||
Constructs a new LSP Response Notification instance.
|
||||
|
||||
:param str method: The type of lsp notification being made.
|
||||
:params dict result: The arguments of the given method.
|
||||
"""
|
||||
jsonrpc: str
|
||||
method: str
|
||||
params: dict
|
||||
|
||||
|
||||
class LSPResponseTypes(LSPResponseRequest, LSPResponseNotification):
|
||||
...
|
Loading…
Reference in New Issue