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): def _subscribe_to_events(self):
event_system.subscribe("textDocument/didOpen", self._lsp_did_open) event_system.subscribe("textDocument/didOpen", self._lsp_did_open)
# event_system.subscribe("textDocument/didSave", self._lsp_did_save) event_system.subscribe("textDocument/didSave", self._lsp_did_save)
# event_system.subscribe("textDocument/didClose", self._lsp_did_close) event_system.subscribe("textDocument/didClose", self._lsp_did_close)
event_system.subscribe("textDocument/didChange", self._lsp_did_change) 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) event_system.subscribe("textDocument/completion", self._lsp_completion)

View File

@ -5,7 +5,15 @@ import os
from gi.repository import GLib from gi.repository import GLib
# Application imports # 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 ) GLib.idle_add( self.send_notification, method, params )
def _lsp_goto(self, data: dict): def _lsp_definition(self, data: dict):
method = data["method"] method = data["method"]
language_id = data["language_id"] params = definition_request["params"]
uri = data["uri"]
line = data["line"] params["textDocument"]["uri"] = data["uri"]
column = data["column"] 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 ) GLib.idle_add( self.send_request, method, params )
@ -94,5 +105,4 @@ class LSPControllerEvents:
params["position"]["line"] = data["line"] params["position"]["line"] = data["line"]
params["position"]["character"] = data["column"] 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", "method": "textDocument/definition",
"params": { "params": {
"textDocument": { "textDocument": {
"uri": "file:///", "uri": "file://",
"languageId": "python", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
@ -45,7 +45,7 @@ didopen_notification = {
"method": "textDocument/didOpen", "method": "textDocument/didOpen",
"params": { "params": {
"textDocument": { "textDocument": {
"uri": "file://<path>", "uri": "file://",
"languageId": "python", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
@ -57,7 +57,7 @@ didsave_notification = {
"method": "textDocument/didSave", "method": "textDocument/didSave",
"params": { "params": {
"textDocument": { "textDocument": {
"uri": "file://<path>" "uri": "file://"
}, },
"text": "" "text": ""
} }
@ -67,7 +67,7 @@ didclose_notification = {
"method": "textDocument/didClose", "method": "textDocument/didClose",
"params": { "params": {
"textDocument": { "textDocument": {
"uri": "file://<path>" "uri": "file://"
} }
} }
} }
@ -77,7 +77,7 @@ didchange_notification = {
"method": "textDocument/didChange", "method": "textDocument/didChange",
"params": { "params": {
"textDocument": { "textDocument": {
"uri": "file://<path>", "uri": "file://",
"languageId": "python", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
@ -130,7 +130,7 @@ definition_request = {
"method": "textDocument/definition", "method": "textDocument/definition",
"params": { "params": {
"textDocument": { "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", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
@ -150,7 +150,7 @@ references_request = {
"includeDeclaration": False "includeDeclaration": False
}, },
"textDocument": { "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", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
@ -168,10 +168,10 @@ symbols_request = {
"method": "textDocument/documentSymbol", "method": "textDocument/documentSymbol",
"params": { "params": {
"textDocument": { "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", "languageId": "python",
"version": 1, "version": 1,
"text": "" "text": ""
} }
} }
} }