Additional wiring of lsp manager calls and responses

This commit is contained in:
itdominator 2024-09-15 01:15:39 -05:00
parent 73e9babd2e
commit f39d1a39f6
3 changed files with 31 additions and 21 deletions

View File

@ -48,10 +48,10 @@ class LSPController(LSPControllerEvents):
def _subscribe_to_events(self):
event_system.subscribe("textDocument/didOpen", self._lsp_did_open)
# event_system.subscribe("textDocument/didSave", self._lsp_did_save)
# event_system.subscribe("textDocument/didClose", self._lsp_did_close)
event_system.subscribe("textDocument/didSave", self._lsp_did_save)
event_system.subscribe("textDocument/didClose", self._lsp_did_close)
event_system.subscribe("textDocument/didChange", self._lsp_did_change)
event_system.subscribe("textDocument/definition", self._lsp_goto)
event_system.subscribe("textDocument/definition", self._lsp_definition)
event_system.subscribe("textDocument/completion", self._lsp_completion)

View File

@ -5,7 +5,15 @@ import os
from gi.repository import GLib
# Application imports
from libs.dto.lsp_messages import get_message_obj, didopen_notification, didsave_notification, didclose_notification, completion_request, didchange_notification
from libs.dto.lsp_messages import get_message_obj
from libs.dto.lsp_messages import didopen_notification
from libs.dto.lsp_messages import didsave_notification
from libs.dto.lsp_messages import didclose_notification
from libs.dto.lsp_messages import didchange_notification
from libs.dto.lsp_messages import completion_request
from libs.dto.lsp_messages import definition_request
from libs.dto.lsp_messages import references_request
from libs.dto.lsp_messages import symbols_request
@ -75,12 +83,15 @@ class LSPControllerEvents:
GLib.idle_add( self.send_notification, method, params )
def _lsp_goto(self, data: dict):
method = data["method"]
language_id = data["language_id"]
uri = data["uri"]
line = data["line"]
column = data["column"]
def _lsp_definition(self, data: dict):
method = data["method"]
params = definition_request["params"]
params["textDocument"]["uri"] = data["uri"]
params["textDocument"]["languageId"] = data["language_id"]
params["textDocument"]["version"] = data["version"]
params["position"]["line"] = data["line"]
params["position"]["character"] = data["column"]
GLib.idle_add( self.send_request, method, params )
@ -94,5 +105,4 @@ class LSPControllerEvents:
params["position"]["line"] = data["line"]
params["position"]["character"] = data["column"]
GLib.idle_add( self.send_request, method, params )
GLib.idle_add( self.send_request, method, params )

View File

@ -27,7 +27,7 @@ content_part = {
"method": "textDocument/definition",
"params": {
"textDocument": {
"uri": "file:///",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
@ -45,7 +45,7 @@ didopen_notification = {
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file://<path>",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
@ -57,7 +57,7 @@ didsave_notification = {
"method": "textDocument/didSave",
"params": {
"textDocument": {
"uri": "file://<path>"
"uri": "file://"
},
"text": ""
}
@ -67,7 +67,7 @@ didclose_notification = {
"method": "textDocument/didClose",
"params": {
"textDocument": {
"uri": "file://<path>"
"uri": "file://"
}
}
}
@ -77,7 +77,7 @@ didchange_notification = {
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file://<path>",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
@ -130,7 +130,7 @@ definition_request = {
"method": "textDocument/definition",
"params": {
"textDocument": {
"uri": "file:///home/abaddon/Coding/Projects/Active/Python_Projects/000_Usable/gtk/LSP-Manager/src/core/widgets/lsp_message_box.py",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
@ -150,7 +150,7 @@ references_request = {
"includeDeclaration": False
},
"textDocument": {
"uri": "file:///home/abaddon/Coding/Projects/Active/Python_Projects/000_Usable/gtk/LSP-Manager/src/core/widgets/lsp_message_box.py",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
@ -168,10 +168,10 @@ symbols_request = {
"method": "textDocument/documentSymbol",
"params": {
"textDocument": {
"uri": "file:///home/abaddon/Coding/Projects/Active/Python_Projects/000_Usable/gtk/LSP-Manager/src/core/widgets/lsp_message_box.py",
"uri": "file://",
"languageId": "python",
"version": 1,
"text": ""
}
}
}
}