Skip to content

Commit

Permalink
Align "Expand Selection" fallback behavior with "Goto Definition" and…
Browse files Browse the repository at this point in the history
… "Find References"
  • Loading branch information
jwortmann committed Sep 16, 2023
1 parent b7e3263 commit 4544186
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Default.sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions plugin/selection_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4544186

Please sign in to comment.