Skip to content

Commit

Permalink
Bump typescript-language-server from 2.2.0 to 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored and predragnikolic committed Dec 30, 2022
1 parent 7978f26 commit ee2809b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 94 deletions.
7 changes: 0 additions & 7 deletions LSP-typescript.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
"command_args": ["${file}"]
}
},
{
"caption": "LSP-typescript: Find Callers",
"command": "lsp_typescript_calls",
"args": {
"direction": "incoming"
},
},
{
"caption": "LSP-typescript: Goto Source Definition",
"command": "lsp_typescript_goto_source_definition",
Expand Down
45 changes: 3 additions & 42 deletions commands.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
from .protocol import Call, CallsDirection, CallsRequestParams, CallsResponse
from LSP.plugin import Request
from LSP.plugin import Session
from LSP.plugin.core.protocol import Location, LocationLink
from LSP.plugin.core.registry import LspTextCommand
from LSP.plugin.core.typing import List, Optional, Union
from LSP.plugin.core.views import text_document_position_params
from LSP.plugin.core.typing import List, Union
from LSP.plugin.execute_command import LspExecuteCommand
from LSP.plugin.locationpicker import LocationPicker
import functools
import sublime


SESSION_NAME = __package__
Expand All @@ -22,7 +15,8 @@ class LspTypescriptGotoSourceDefinitionCommand(LspTypescriptExecuteCommand):
def handle_success_async(self, result: Union[List[Location], List[LocationLink]], command_name: str) -> None:
if not result:
window = self.view.window()
window and window.status_message('No source definitions found')
if window:
window.status_message('No source definitions found')
return
session = self.session_by_name()
if not session:
Expand All @@ -35,36 +29,3 @@ def handle_success_async(self, result: Union[List[Location], List[LocationLink]]
self.view.run_command('lsp_open_location', args)
else:
LocationPicker(self.view, session, result, side_by_side=False)


class LspTypescriptCallsCommand(LspTextCommand):
session_name = SESSION_NAME

def is_enabled(self) -> bool:
selection = self.view.sel()
return len(selection) > 0 and super().is_enabled()

def run(self, edit: sublime.Edit, direction: CallsDirection) -> None:
session = self.session_by_name(self.session_name)
if session is None:
return
position_params = text_document_position_params(self.view, self.view.sel()[0].b)
params = {
'textDocument': position_params['textDocument'],
'position': position_params['position'],
'direction': direction
} # type: CallsRequestParams
session.send_request(Request("textDocument/calls", params), functools.partial(self.on_result_async, session))

def on_result_async(self, session: Session, result: Optional[CallsResponse]) -> None:
if not result:
return

def to_location_link(call: Call) -> LocationLink:
return {
'targetUri': call['location']['uri'],
'targetSelectionRange': call['location']['range'],
}

locations = list(map(to_location_link, result['calls']))
LocationPicker(self.view, session, locations, side_by_side=False)
29 changes: 0 additions & 29 deletions protocol.py

This file was deleted.

30 changes: 15 additions & 15 deletions typescript-language-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion typescript-language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"private": true,
"dependencies": {
"typescript": "4.9.4",
"typescript-language-server": "2.2.0"
"typescript-language-server": "3.0.1"
}
}

0 comments on commit ee2809b

Please sign in to comment.