Skip to content

Commit db96b88

Browse files
rchlrwols
authored andcommitted
Support side_by_side for "Go to reference"
1 parent a9444ae commit db96b88

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

Default.sublime-keymap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
// Find References
154154
{
155155
"command": "lsp_symbol_references",
156+
"args": {
157+
"side_by_side": false
158+
},
156159
"keys": [
157160
"shift+f12"
158161
],

plugin/references.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class LspSymbolReferencesCommand(LspTextCommand):
3030

3131
capability = 'referencesProvider'
3232

33-
def run(self, _: sublime.Edit, event: Optional[dict] = None, point: Optional[int] = None) -> None:
33+
def run(
34+
self, _: sublime.Edit, event: Optional[dict] = None, point: Optional[int] = None, side_by_side: bool = False
35+
) -> None:
3436
session = self.best_session(self.capability)
3537
file_path = self.view.file_name()
3638
pos = get_position(self.view, event, point)
@@ -47,27 +49,32 @@ def run(self, _: sublime.Edit, event: Optional[dict] = None, point: Optional[int
4749
functools.partial(
4850
self._handle_response_async,
4951
self.view.substr(self.view.word(pos)),
50-
session
52+
session,
53+
side_by_side
5154
)
5255
)
5356

54-
def _handle_response_async(self, word: str, session: Session, response: Optional[List[Location]]) -> None:
55-
sublime.set_timeout(lambda: self._handle_response(word, session, response))
57+
def _handle_response_async(
58+
self, word: str, session: Session, side_by_side: bool, response: Optional[List[Location]]
59+
) -> None:
60+
sublime.set_timeout(lambda: self._handle_response(word, session, side_by_side, response))
5661

57-
def _handle_response(self, word: str, session: Session, response: Optional[List[Location]]) -> None:
62+
def _handle_response(
63+
self, word: str, session: Session, side_by_side: bool, response: Optional[List[Location]]
64+
) -> None:
5865
if response:
5966
if userprefs().show_references_in_quick_panel:
60-
self._show_references_in_quick_panel(session, response)
67+
self._show_references_in_quick_panel(session, response, side_by_side)
6168
else:
6269
self._show_references_in_output_panel(word, session, response)
6370
else:
6471
window = self.view.window()
6572
if window:
6673
window.status_message("No references found")
6774

68-
def _show_references_in_quick_panel(self, session: Session, locations: List[Location]) -> None:
75+
def _show_references_in_quick_panel(self, session: Session, locations: List[Location], side_by_side: bool) -> None:
6976
self.view.run_command("add_jump_record", {"selection": [(r.a, r.b) for r in self.view.sel()]})
70-
LocationPicker(self.view, session, locations, side_by_side=False)
77+
LocationPicker(self.view, session, locations, side_by_side)
7178

7279
def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:
7380
window = session.window

0 commit comments

Comments
 (0)