Added rclick copy to clip-board; extended LSP config

This commit is contained in:
itdominator 2024-09-30 18:38:32 -05:00
parent 96abe163a5
commit d00818a5b2
6 changed files with 50 additions and 18 deletions

View File

@ -52,6 +52,7 @@ class BaseController(IPCSignalsMixin, KeyboardSignalsMixin, BaseControllerData):
event_system.subscribe("handle-file-from-ipc", self.handle_file_from_ipc) event_system.subscribe("handle-file-from-ipc", self.handle_file_from_ipc)
event_system.subscribe("handle-dir-from-ipc", self.handle_dir_from_ipc) event_system.subscribe("handle-dir-from-ipc", self.handle_dir_from_ipc)
event_system.subscribe("tggl-top-main-menubar", self._tggl_top_main_menubar) event_system.subscribe("tggl-top-main-menubar", self._tggl_top_main_menubar)
event_system.subscribe("copy-to-clipboard", self.set_clipboard_data)
def _load_controllers(self): def _load_controllers(self):
BridgeController() BridgeController()
@ -66,4 +67,4 @@ class BaseController(IPCSignalsMixin, KeyboardSignalsMixin, BaseControllerData):
settings_manager.set_builder(self.builder) settings_manager.set_builder(self.builder)
self.base_container = BaseContainer() self.base_container = BaseContainer()
settings_manager.register_signals_to_builder([self, self.base_container]) settings_manager.register_signals_to_builder([self, self.base_container])

View File

@ -9,7 +9,7 @@ from gi.repository import GLib
from libs.dto.lsp_messages import LEN_HEADER, TYPE_HEADER, get_message_str, get_message_obj from libs.dto.lsp_messages import LEN_HEADER, TYPE_HEADER, get_message_str, get_message_obj
from .lsp_controller_base import LSPControllerBase from .lsp_controller_base import LSPControllerBase
from libs.dto.lsp_message_structs import \ from libs.dto.lsp_message_structs import \
LSPResponseTypes, ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification LSPResponseTypes, ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification, LSPResponseNotification
@ -109,9 +109,9 @@ class LSPControllerSTDInSTDOut(LSPControllerBase):
lsp_response = LSPResponseRequest(**get_message_obj(data)) lsp_response = LSPResponseRequest(**get_message_obj(data))
if "method" in keys: if "method" in keys:
lsp_response = LSPResponseNotification(**get_message_obj(data)) lsp_response = LSPResponseNotification(**get_message_obj(data)) if not "id" in keys else LSPIDResponseNotification( **get_message_obj(data) )
response_id = -1 response_id = -1
if not lsp_response: return if not lsp_response: return
GLib.idle_add(self.handle_lsp_response, lsp_response) GLib.idle_add(self.handle_lsp_response, lsp_response)

View File

@ -10,7 +10,7 @@ from gi.repository import GLib
from libs.websocket_client import WebsocketClient from libs.websocket_client import WebsocketClient
from libs.dto.lsp_messages import LEN_HEADER, TYPE_HEADER, get_message_str, get_message_obj from libs.dto.lsp_messages import LEN_HEADER, TYPE_HEADER, get_message_str, get_message_obj
from libs.dto.lsp_message_structs import \ from libs.dto.lsp_message_structs import \
LSPResponseTypes, ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification LSPResponseTypes, ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification, LSPIDResponseNotification
from .lsp_controller_base import LSPControllerBase from .lsp_controller_base import LSPControllerBase
@ -77,7 +77,7 @@ class LSPControllerWebsocket(LSPControllerBase):
lsp_response = LSPResponseRequest(**get_message_obj(data)) lsp_response = LSPResponseRequest(**get_message_obj(data))
if "method" in keys: if "method" in keys:
lsp_response = LSPResponseNotification(**get_message_obj(data)) lsp_response = LSPResponseNotification(**get_message_obj(data)) if not "id" in keys else LSPIDResponseNotification( **get_message_obj(data) )
response_id = -1 response_id = -1

View File

@ -37,6 +37,7 @@ class LogList(Gtk.ListBox):
def tggl_row_view(lb, row): def tggl_row_view(lb, row):
frame = row.get_child() frame = row.get_child()
revealer = frame.get_children()[0] revealer = frame.get_children()[0]
self._active_label = revealer.get_children()[0]
revealer.set_reveal_child( not revealer.get_reveal_child() ) revealer.set_reveal_child( not revealer.get_reveal_child() )
del frame del frame
@ -47,6 +48,7 @@ class LogList(Gtk.ListBox):
self.connect("row-activated", tggl_row_view) self.connect("row-activated", tggl_row_view)
self.connect("size-allocate", scroll_down) self.connect("size-allocate", scroll_down)
self.connect("button-release-event", self._label_button_release_event)
def _subscribe_to_events(self): def _subscribe_to_events(self):
... ...
@ -87,4 +89,9 @@ class LogList(Gtk.ListBox):
def scroll_down(self): def scroll_down(self):
vadjustment = self.get_parent().get_vadjustment() vadjustment = self.get_parent().get_vadjustment()
vadjustment.set_value( vadjustment.get_upper()) vadjustment.set_value( vadjustment.get_upper())
def _label_button_release_event(self, log_list, eve):
if eve.button == 3:
event_system.emit("copy-to-clipboard", self._active_label.get_label())
return True

View File

@ -71,12 +71,25 @@ class LSPResponseNotification(object):
method: str method: str
params: dict params: dict
@dataclass
class LSPIDResponseNotification(object):
"""
Constructs a new LSP Response Notification instance.
class MessageTypes(ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification): :param str method: The type of lsp notification being made.
:params dict result: The arguments of the given method.
"""
jsonrpc: str
id: int
method: str
params: dict
class MessageTypes(ClientRequest, ClientNotification, LSPResponseRequest, LSPResponseNotification, LSPIDResponseNotification):
... ...
class ClientMessageTypes(ClientRequest, ClientNotification): class ClientMessageTypes(ClientRequest, ClientNotification):
... ...
class LSPResponseTypes(LSPResponseRequest, LSPResponseNotification): class LSPResponseTypes(LSPResponseRequest, LSPResponseNotification):
... ...

View File

@ -2,6 +2,7 @@
"java": { "java": {
"info": "https://download.eclipse.org/jdtls/", "info": "https://download.eclipse.org/jdtls/",
"info-init-options": "https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line", "info-init-options": "https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line",
"info-import-build": "https://www.javahotchocolate.com/tutorials/build-path.html",
"link": "https://download.eclipse.org/jdtls/milestones/?d", "link": "https://download.eclipse.org/jdtls/milestones/?d",
"command": "lsp-ws-proxy --listen 4114 -- jdtls", "command": "lsp-ws-proxy --listen 4114 -- jdtls",
"alt-command": "lsp-ws-proxy -- jdtls", "alt-command": "lsp-ws-proxy -- jdtls",
@ -13,8 +14,7 @@
"intellicode-core.jar" "intellicode-core.jar"
], ],
"workspaceFolders": [ "workspaceFolders": [
"<uri>", "file://"
"<uri>"
], ],
"settings": { "settings": {
"java": { "java": {
@ -36,18 +36,29 @@
"globalSettings": "{user.home}/.config/jdtls/settings.xml" "globalSettings": "{user.home}/.config/jdtls/settings.xml"
}, },
"runtimes": [ "runtimes": [
{
"name": "JavaSE-17",
"path": "/usr/lib/jvm/default-runtime",
"javadoc": "https://docs.oracle.com/en/java/javase/17/docs/api/",
"default": true
}
] ]
}, },
"classPath": [ "classPath": [
"{user.home}/.config/jdtls/m2/repository/**/*.jar" "{user.home}/.config/jdtls/m2/repository/**/*-sources.jar",
"lib/**/*-sources.jar"
], ],
"docPath": [ "docPath": [
"{user.home}/.config/jdtls/m2/repository/**/*.jar" "{user.home}/.config/jdtls/m2/repository/**/*-javadoc.jar",
"lib/**/*-javadoc.jar"
], ],
"silentNotification": true, "silentNotification": true,
"project": { "project": {
"encoding": "ignore",
"outputPath": "bin",
"referencedLibraries": [ "referencedLibraries": [
"lib/**/*.jar" "lib/**/*.jar",
"{user.home}/.config/jdtls/m2/repository/**/*.jar"
], ],
"importOnFirstTimeStartup": "automatic", "importOnFirstTimeStartup": "automatic",
"importHint": true, "importHint": true,
@ -55,10 +66,10 @@
"node_modules", "node_modules",
"\\.git" "\\.git"
], ],
"encoding": "ignore", "sourcePaths": [
"exportJar": { "src",
"targetPath": "${workspaceFolder}/${workspaceFolderBasename}.jar" "{user.home}/.config/jdtls/m2/repository/**/*.jar"
} ]
}, },
"sources": { "sources": {
"organizeImports": { "organizeImports": {