Skip to content

Commit 3c58eb9

Browse files
committed
rename NavToCommand and add command entry
1 parent 21cc1f5 commit 3c58eb9

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Default.sublime-keymap

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"keys": [ "ctrl+alt+r"],
27-
"command": "nav_to",
27+
"command": "typescript_nav_to",
2828
"context": [
2929
{ "key": "selector", "operator": "equal", "operand": "source.ts" }
3030
]

TypeScript.py

+23-22
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,13 @@ def change_count(self, view):
533533
def on_activated(self, view):
534534
logger.view_debug(view, "enter on_activated " + str(view.id()))
535535
if is_special_view(view):
536-
if NavToCommand.navto_panel_started:
536+
if TypescriptNavToCommand.navto_panel_started:
537537
# The current view is the QuickPanel. Set insert_text_finished to false to suppress
538538
# handling in on_modified
539-
NavToCommand.insert_text_finished = False
540-
view.run_command("insert", {"characters": NavToCommand.input_text})
539+
TypescriptNavToCommand.insert_text_finished = False
540+
view.run_command("insert", {"characters": TypescriptNavToCommand.input_text})
541541
# Re-enable the handling in on_modified
542-
NavToCommand.insert_text_finished = True
542+
TypescriptNavToCommand.insert_text_finished = True
543543

544544
if not self.about_to_close_all:
545545
info = self.getInfo(view)
@@ -835,14 +835,14 @@ def on_modified(self, view):
835835
# it is a special view
836836
if is_special_view(view):
837837
logger.log.debug("enter on_modified: special view. started: %s, insert_text_finished: %s" %
838-
(NavToCommand.navto_panel_started, NavToCommand.insert_text_finished))
838+
(TypescriptNavToCommand.navto_panel_started, TypescriptNavToCommand.insert_text_finished))
839839

840-
if NavToCommand.navto_panel_started and NavToCommand.insert_text_finished:
840+
if TypescriptNavToCommand.navto_panel_started and TypescriptNavToCommand.insert_text_finished:
841841
new_content = view.substr(sublime.Region(0, view.size()))
842-
sublime.active_window().run_command("nav_to", {'input_text': new_content})
842+
sublime.active_window().run_command("typescript_nav_to", {'input_text': new_content})
843843

844844
logger.log.debug("exit on_modified: special view. started: %s, insert_text_finished: %s" %
845-
(NavToCommand.navto_panel_started, NavToCommand.insert_text_finished))
845+
(TypescriptNavToCommand.navto_panel_started, TypescriptNavToCommand.insert_text_finished))
846846
# it is a normal view
847847
else:
848848
info = self.getInfo(view)
@@ -1621,7 +1621,8 @@ def run(self, text):
16211621
formatRange(text, view, rblineStart, ralineEnd)
16221622

16231623

1624-
class NavToCommand(sublime_plugin.WindowCommand):
1624+
class TypescriptNavToCommand(sublime_plugin.WindowCommand):
1625+
16251626
navto_panel_started = False
16261627

16271628
# indicate if the insert_text command has finished pasting text into the textbox.
@@ -1646,19 +1647,19 @@ def is_enabled(self):
16461647
def run(self, input_text = ""):
16471648
logger.log.debug("start running navto with text: %s" % input_text)
16481649

1649-
NavToCommand.reset_already = False
1650+
TypescriptNavToCommand.reset_already = False
16501651

16511652
self.window.run_command("hide_overlay")
16521653

1653-
if NavToCommand.reset_already:
1654-
NavToCommand.reset_already = False
1654+
if TypescriptNavToCommand.reset_already:
1655+
TypescriptNavToCommand.reset_already = False
16551656
else:
16561657
logger.log.debug("reset in run")
1657-
NavToCommand.reset()
1658-
NavToCommand.reset_already = True
1658+
TypescriptNavToCommand.reset()
1659+
TypescriptNavToCommand.reset_already = True
16591660

1660-
NavToCommand.input_text = input_text
1661-
NavToCommand.navto_panel_started = True
1661+
TypescriptNavToCommand.input_text = input_text
1662+
TypescriptNavToCommand.navto_panel_started = True
16621663

16631664
# Text used for querying is not always equal to the input text. This is because the quick
16641665
# panel will disappear if an empty list is provided, and we want to avoid this. Therefore
@@ -1673,14 +1674,14 @@ def run(self, input_text = ""):
16731674

16741675
def on_done(self, index):
16751676
logger.log.debug("enter on_done. input_text: %s, started: %s, insert_text_finished: %s" %
1676-
(NavToCommand.input_text, NavToCommand.navto_panel_started, NavToCommand.insert_text_finished))
1677+
(TypescriptNavToCommand.input_text, TypescriptNavToCommand.navto_panel_started, TypescriptNavToCommand.insert_text_finished))
16771678

1678-
if NavToCommand.reset_already:
1679-
NavToCommand.reset_already = False
1679+
if TypescriptNavToCommand.reset_already:
1680+
TypescriptNavToCommand.reset_already = False
16801681
else:
16811682
logger.log.debug("reset in on_done")
1682-
NavToCommand.reset()
1683-
NavToCommand.reset_already = True
1683+
TypescriptNavToCommand.reset()
1684+
TypescriptNavToCommand.reset_already = True
16841685

16851686
if index >= 0:
16861687
item = self.items[index]
@@ -1689,7 +1690,7 @@ def on_done(self, index):
16891690
self.window.open_file(file_at_location, sublime.ENCODED_POSITION)
16901691

16911692
logger.log.debug("exit on_done. input_text: %s, started: %s, insert_text_finished: %s" %
1692-
(NavToCommand.input_text, NavToCommand.navto_panel_started, NavToCommand.insert_text_finished))
1693+
(TypescriptNavToCommand.input_text, TypescriptNavToCommand.navto_panel_started, TypescriptNavToCommand.insert_text_finished))
16931694

16941695
def format_navto_result(self, item_list):
16951696

TypeScript.sublime-commands

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{ "caption" : "TypeScript: FormatSelection", "command": "typescript_format_selection" },
77
{ "caption" : "TypeScript: FormatDocument", "command": "typescript_format_document" },
88
{ "caption" : "TypeScript: FindReferences", "command": "typescript_find_references" },
9+
{ "caption" : "TypeScript: NavigateToSymbol", "command": "typescript_nav_to" },
910
{ "caption" : "TypeScript: Rename", "command": "typescript_rename" },
1011
{ "caption" : "TypeScript: PasteAndFormat", "command": "typescript_paste_and_format" },
1112
{ "caption" : "TypeScript: FormatLine", "command": "typescript_format_line" },

0 commit comments

Comments
 (0)