From 0eaa563e622e9a071a66d6b6fb00d58b6af3fc37 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Thu, 1 Feb 2024 20:13:01 +0100 Subject: [PATCH] update naming --- Default.sublime-commands | 6 +++--- docs/src/keyboard_shortcuts.md | 2 +- plugin/__init__.py | 2 ++ plugin/references.py | 26 +++++++++++++------------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Default.sublime-commands b/Default.sublime-commands index 4bfcba5bc..75bb04d95 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -122,17 +122,17 @@ "command": "lsp_symbol_references" }, { - "caption": "LSP: Find References (Bottom Panel)", + "caption": "LSP: Find References (Output Panel)", "command": "lsp_symbol_references", "args": { - "show_in": "output_panel" + "output_mode": "output_panel" }, }, { "caption": "LSP: Find References (Quick Panel)", "command": "lsp_symbol_references", "args": { - "show_in": "quick_panel" + "output_mode": "quick_panel" }, }, { diff --git a/docs/src/keyboard_shortcuts.md b/docs/src/keyboard_shortcuts.md index 8869c841e..e277c542f 100644 --- a/docs/src/keyboard_shortcuts.md +++ b/docs/src/keyboard_shortcuts.md @@ -9,7 +9,7 @@ Refer to the [Customization section](customization.md#keyboard-shortcuts-key-bin | ------- | -------- | ------- | | Auto Complete | ctrl space (also on macOS) | `auto_complete` | Expand Selection | unbound | `lsp_expand_selection` -| Find References | shift f12 | `lsp_symbol_references`
Supports optional args: `{"include_declaration": true | false, "show_in": "output_panel" | "quick_panel"}`.
Triggering from context menus while holding ctrl opens in "side by side" mode. Holding shift triggers opposite behavior relative to what `show_references_in_quick_panel` is set to. +| Find References | shift f12 | `lsp_symbol_references`
Supports optional args: `{"include_declaration": true | false, "output_mode": "output_panel" | "quick_panel"}`.
Triggering from context menus while holding ctrl opens in "side by side" mode. Holding shift triggers opposite behavior relative to what `show_references_in_quick_panel` is set to. | Fold | unbound | `lsp_fold`
Supports optional args: `{"strict": true/false}` - to configure whether to fold only when the caret is contained within the folded region (`true`), or even when it is anywhere on the starting line (`false`). | Fold All | unbound | `lsp_fold_all`
Supports optional args: `{"kind": "comment" | "imports" | "region"}`. | Follow Link | unbound | `lsp_open_link` diff --git a/plugin/__init__.py b/plugin/__init__.py index 3f009dd68..17feaa4fc 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -12,6 +12,7 @@ from .core.registry import LspTextCommand from .core.registry import LspWindowCommand from .core.sessions import AbstractPlugin +from .core.sessions import AbstractPluginV2 from .core.sessions import register_plugin from .core.sessions import Session from .core.sessions import SessionBufferProtocol @@ -30,6 +31,7 @@ __all__ = [ '__version__', 'AbstractPlugin', + 'AbstractPluginV2', 'apply_text_edits', 'ClientConfig', 'css', diff --git a/plugin/references.py b/plugin/references.py index 61b76b331..03f106deb 100644 --- a/plugin/references.py +++ b/plugin/references.py @@ -20,7 +20,7 @@ import sublime -ShowInArgument = Literal['output_panel', 'quick_panel'] +OutputMode = Literal['output_panel', 'quick_panel'] class LspSymbolReferencesCommand(LspTextCommand): @@ -36,7 +36,7 @@ def is_enabled( fallback: bool = False, group: int = -1, include_declaration: bool = False, - show_in: Optional[ShowInArgument] = None, + output_mode: Optional[OutputMode] = None, ) -> bool: return fallback or super().is_enabled(event, point) @@ -49,17 +49,17 @@ def is_visible( fallback: bool = False, group: int = -1, include_declaration: bool = False, - show_in: Optional[ShowInArgument] = None, + output_mode: Optional[OutputMode] = None, ) -> bool: # We include "output panel" and "quick panel" variants of `LSP: Find References` in the Command Palette # but we only show the one that is not the same as the default one (per the `show_references_in_quick_panel` # setting). - if show_in == 'output_panel' and not userprefs().show_references_in_quick_panel or \ - show_in == 'quick_panel' and userprefs().show_references_in_quick_panel: + if output_mode == 'output_panel' and not userprefs().show_references_in_quick_panel or \ + output_mode == 'quick_panel' and userprefs().show_references_in_quick_panel: return False if self.applies_to_context_menu(event): return self.is_enabled( - event, point, side_by_side, force_group, fallback, group, include_declaration, show_in) + event, point, side_by_side, force_group, fallback, group, include_declaration, output_mode) return True def run( @@ -72,7 +72,7 @@ def run( fallback: bool = False, group: int = -1, include_declaration: bool = False, - show_in: Optional[ShowInArgument] = None, + output_mode: Optional[OutputMode] = None, ) -> None: session = self.best_session(self.capability) file_path = self.view.file_name() @@ -98,7 +98,7 @@ def run( force_group, fallback, group, - show_in, + output_mode, event, word_range.begin() ) @@ -114,13 +114,13 @@ def _handle_response_async( force_group: bool, fallback: bool, group: int, - show_in: Optional[ShowInArgument], + output_mode: Optional[OutputMode], event: Optional[dict], position: int, response: Optional[List[Location]] ) -> None: sublime.set_timeout(lambda: self._handle_response( - word, session, side_by_side, force_group, fallback, group, show_in, event, position, response)) + word, session, side_by_side, force_group, fallback, group, output_mode, event, position, response)) def _handle_response( self, @@ -130,7 +130,7 @@ def _handle_response( force_group: bool, fallback: bool, group: int, - show_in: Optional[ShowInArgument], + output_mode: Optional[OutputMode], event: Optional[dict], position: int, response: Optional[List[Location]] @@ -139,12 +139,12 @@ def _handle_response( self._handle_no_results(fallback, side_by_side) return modifier_keys = (event or {}).get('modifier_keys', {}) - if show_in is None: + if output_mode is None: show_in_quick_panel = userprefs().show_references_in_quick_panel if modifier_keys.get('shift'): show_in_quick_panel = not show_in_quick_panel else: - show_in_quick_panel = show_in == 'quick_panel' + show_in_quick_panel = output_mode == 'quick_panel' if show_in_quick_panel: if modifier_keys.get('primary'): side_by_side = True