Skip to content

Commit afe80c8

Browse files
committed
Make the menu items work with cloned plugin
1 parent ecc6939 commit afe80c8

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

Main.sublime-menu

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
"caption": "TypeScript",
1919
"children": [
2020
{
21-
"command": "open_file",
22-
"args": {
23-
"file": "${packages}/TypeScript/Preferences.sublime-settings"
24-
},
21+
"command": "typescript_open_plugin_default_setting_file",
2522
"caption": "Plugin Settings – Default"
2623
},
2724
{
@@ -35,10 +32,7 @@
3532
"caption": "-"
3633
},
3734
{
38-
"command": "open_file",
39-
"args": {
40-
"file": "${packages}/TypeScript/TypeScript.sublime-settings"
41-
},
35+
"command":"typescript_open_ts_default_setting_file",
4236
"caption": "TypeScript Settings – Default"
4337
},
4438
{
@@ -52,10 +46,7 @@
5246
"caption": "-"
5347
},
5448
{
55-
"command": "open_file",
56-
"args": {
57-
"file": "${packages}/TypeScript/TypeScriptReact.sublime-settings"
58-
},
49+
"command":"typescript_open_tsreact_default_setting_file",
5950
"caption": "TypeScriptReact Settings – Default"
6051
},
6152
{

typescript/commands/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
TypescriptRenameCommand
3030
)
3131
from .build import TypescriptBuildCommand
32+
from .settings import (
33+
TypescriptOpenPluginDefaultSettingFile,
34+
TypescriptOpenTsDefaultSettingFile,
35+
TypescriptOpenTsreactDefaultSettingFile
36+
)
3237

3338
__all__ = [
3439
"TypescriptAutoIndentOnEnterBetweenCurlyBrackets",
@@ -59,5 +64,8 @@
5964
"TypescriptShowDoc",
6065
"TypescriptSignaturePanel",
6166
"TypescriptSignaturePopup",
62-
"TypescriptBuildCommand"
67+
"TypescriptBuildCommand",
68+
"TypescriptOpenPluginDefaultSettingFile",
69+
"TypescriptOpenTsDefaultSettingFile",
70+
"TypescriptOpenTsreactDefaultSettingFile"
6371
]

typescript/commands/settings.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sublime_plugin
2+
3+
from ..libs.global_vars import *
4+
from ..libs import cli, logger
5+
import os
6+
7+
class TypescriptOpenPluginDefaultSettingFile(sublime_plugin.WindowCommand):
8+
def run(self):
9+
default_plugin_setting_path = os.path.join(PLUGIN_DIR, "Preferences.sublime-settings")
10+
sublime.active_window().open_file(default_plugin_setting_path)
11+
12+
class TypescriptOpenTsDefaultSettingFile(sublime_plugin.WindowCommand):
13+
def run(self):
14+
default_ts_setting_path = os.path.join(PLUGIN_DIR, "TypeScript.sublime-settings")
15+
sublime.active_window().open_file(default_ts_setting_path)
16+
17+
class TypescriptOpenTsreactDefaultSettingFile(sublime_plugin.WindowCommand):
18+
def run(self):
19+
default_tsreact_setting_path = os.path.join(PLUGIN_DIR, "TypeScriptReact.sublime-settings")
20+
sublime.active_window().open_file(default_tsreact_setting_path)

0 commit comments

Comments
 (0)