forked from sublimelsp/LSP-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.py
32 lines (26 loc) · 1.07 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from LSP.plugin.core.protocol import Location, LocationLink
from LSP.plugin.core.typing import List, Union
from LSP.plugin.execute_command import LspExecuteCommand
from LSP.plugin.locationpicker import LocationPicker
SESSION_NAME = __package__
class LspVtslsExecuteCommand(LspExecuteCommand):
session_name = SESSION_NAME
class LspVtslsGotoSourceDefinitionCommand(LspVtslsExecuteCommand):
def handle_success_async(self, result: Union[List[Location], List[LocationLink]], command_name: str) -> None:
window = self.view.window()
if not result:
if window:
window.status_message('No source definitions found')
return
session = self.session_by_name()
if not session:
return
if len(result) == 1:
args = {
'location': result[0],
'session_name': self.session_name,
}
if window:
window.run_command('lsp_open_location', args)
else:
LocationPicker(self.view, session, result, side_by_side=False)