feat(lsp): support Java class file contents and improve definition navigation handling
- Add `_lsp_java_class_file_contents` request to fetch contents of compiled Java classes via LSP (`java/classFileContents`). - Handle `java/classFileContents` responses by opening a new buffer with Java syntax highlighting and inserting the returned source. - Update definition handling to pass URI and range, enabling precise cursor placement after navigation. - Detect `jdt://` URIs in `textDocument/definition` responses and request class file contents instead of direct navigation. - Move goto navigation logic into `LSPServerEventsMixin`, using event system to access the active view and position the cursor. - Expose `emit` and `emit_to` to the response cache for event dispatching. - Restrict completion activation to `USER_REQUESTED`. - Add TODO note about mapping language IDs to dedicated response handlers.
This commit is contained in:
@@ -55,11 +55,9 @@ class Plugin(PluginCode):
|
||||
lsp_manager.load_lsp_servers_config()
|
||||
lsp_manager.set_source_view(source_view)
|
||||
lsp_manager.load_lsp_servers_config_placeholders()
|
||||
lsp_manager.provider.response_cache._prompt_completion_request = \
|
||||
self._prompt_completion_request
|
||||
|
||||
lsp_manager.provider.response_cache._prompt_goto_request = \
|
||||
self._prompt_goto_request
|
||||
lsp_manager.provider.response_cache.emit = self.emit
|
||||
lsp_manager.provider.response_cache.emit_to = self.emit_to
|
||||
lsp_manager.provider.response_cache._prompt_completion_request = self._prompt_completion_request
|
||||
|
||||
def run(self):
|
||||
...
|
||||
@@ -82,15 +80,6 @@ class Plugin(PluginCode):
|
||||
self.emit_to("completion", event)
|
||||
|
||||
|
||||
def _prompt_goto_request(self, uri: str):
|
||||
event = Event_Factory.create_event(
|
||||
"get_active_view",
|
||||
)
|
||||
self.emit_to("source_views", event)
|
||||
view = event.response
|
||||
view._on_uri_data_received( [uri] )
|
||||
|
||||
|
||||
class Handler:
|
||||
@staticmethod
|
||||
def execute(
|
||||
|
||||
Reference in New Issue
Block a user