From 4544186b14ea1714aed2961d9252c419a59e5807 Mon Sep 17 00:00:00 2001 From: Janos Wortmann Date: Sat, 16 Sep 2023 16:55:30 +0200 Subject: [PATCH] Align "Expand Selection" fallback behavior with "Goto Definition" and "Find References" --- Default.sublime-keymap | 1 + plugin/selection_range.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Default.sublime-keymap b/Default.sublime-keymap index 2b9760d23..d95ffdb9e 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -211,6 +211,7 @@ // { // "keys": ["primary+shift+a"], // "command": "lsp_expand_selection", + // "args": {"fallback": false}, // "context": [{"key": "lsp.session_with_capability", "operand": "selectionRangeProvider"}] // }, // Fold around caret position - an optional "strict" argument can be used to configure whether diff --git a/plugin/selection_range.py b/plugin/selection_range.py index cd30de558..d318a721b 100644 --- a/plugin/selection_range.py +++ b/plugin/selection_range.py @@ -17,15 +17,15 @@ def __init__(self, view: sublime.View) -> None: self._regions = [] # type: List[sublime.Region] self._change_count = 0 - def is_enabled(self, event: Optional[dict] = None, point: Optional[int] = None, fallback: bool = True) -> bool: + def is_enabled(self, event: Optional[dict] = None, point: Optional[int] = None, fallback: bool = False) -> bool: return fallback or super().is_enabled(event, point) - def is_visible(self, event: Optional[dict] = None, point: Optional[int] = None, fallback: bool = True) -> bool: + def is_visible(self, event: Optional[dict] = None, point: Optional[int] = None, fallback: bool = False) -> bool: if self.applies_to_context_menu(event): return self.is_enabled(event, point, fallback) return True - def run(self, edit: sublime.Edit, event: Optional[dict] = None, fallback: bool = True) -> None: + def run(self, edit: sublime.Edit, event: Optional[dict] = None, fallback: bool = False) -> None: position = get_position(self.view, event) if position is None: return