Skip to content

Commit d54ce6b

Browse files
bug fixes
1 parent 740c601 commit d54ce6b

File tree

17 files changed

+72
-152
lines changed

17 files changed

+72
-152
lines changed

Default (OSX).sublime-keymap

Lines changed: 0 additions & 20 deletions
This file was deleted.

Default (Windows).sublime-keymap

Lines changed: 0 additions & 20 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

Main.sublime-menu

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -123,65 +123,22 @@
123123
"caption": "JavaScript Enhancements",
124124
"children": [
125125
{
126-
"caption": "Settings - Default",
127-
"command": "open_file",
128-
"args": {"file": "${packages}/JavaScript Enhancements/settings.sublime-settings"}
129-
},
130-
{
131-
"caption": "Settings - User",
132-
"command": "open_file",
133-
"args": {"file": "${packages}/User/JavaScript Enhancements/settings.sublime-settings"}
126+
"caption": "Settings",
127+
"command": "edit_settings",
128+
"args": {
129+
"base_file": "${packages}/JavaScript Enhancements/JavaScript Enhancements.sublime-settings",
130+
"default": "{}"
131+
}
134132
},
135133
{ "caption": "-" },
136134
{
137-
"command": "open_file",
138-
"args": {
139-
"file": "${packages}/JavaScript Enhancements/Default (OSX).sublime-keymap",
140-
"platform": "OSX"
141-
},
142-
"caption": "Key Bindings – Default"
143-
},
144-
{
145-
"command": "open_file",
146-
"args": {
147-
"file": "${packages}/JavaScript Enhancements/Default (Linux).sublime-keymap",
148-
"platform": "Linux"
149-
},
150-
"caption": "Key Bindings – Default"
151-
},
152-
{
153-
"command": "open_file",
154-
"args": {
155-
"file": "${packages}/JavaScript Enhancements/Default (Windows).sublime-keymap",
156-
"platform": "Windows"
157-
},
158-
"caption": "Key Bindings – Default"
159-
},
160-
{
161-
"command": "open_file",
162-
"args": {
163-
"file": "${packages}/User/Default (OSX).sublime-keymap",
164-
"platform": "OSX"
165-
},
166-
"caption": "Key Bindings – User"
167-
},
168-
{
169-
"command": "open_file",
135+
"command": "edit_settings",
170136
"args": {
171-
"file": "${packages}/User/Default (Linux).sublime-keymap",
172-
"platform": "Linux"
137+
"base_file": "${packages}/JavaScript Enhancements/Default.sublime-keymap",
138+
"default": "{}"
173139
},
174-
"caption": "Key Bindings – User"
175-
},
176-
{
177-
"command": "open_file",
178-
"args": {
179-
"file": "${packages}/User/Default (Windows).sublime-keymap",
180-
"platform": "Windows"
181-
},
182-
"caption": "Key Bindings – User"
183-
},
184-
{ "caption": "-" }
140+
"caption": "Key Bindings"
141+
}
185142
]
186143
}
187144
]

_generated_2017_12_29_at_01_42_12.py renamed to _generated_2017_12_29_at_23_44_53.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,19 @@ def stop(self):
137137
NODE_MODULES_BIN_PATH = os.path.join(NODE_MODULES_PATH, ".bin")
138138

139139
def get_node_js_custom_path():
140-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
140+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
141141
if json_file and "node_js_custom_path" in json_file :
142142
return json_file.get("node_js_custom_path").strip()
143143
return ""
144144

145145
def get_npm_custom_path():
146-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
146+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
147147
if json_file and "npm_custom_path" in json_file :
148148
return json_file.get("npm_custom_path").strip()
149149
return ""
150150

151151
def get_yarn_custom_path():
152-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
152+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
153153
if json_file and "yarn_custom_path" in json_file :
154154
return json_file.get("yarn_custom_path").strip()
155155
return ""
@@ -246,7 +246,7 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
246246

247247
if chdir:
248248
os.chdir(owd)
249-
249+
250250
if clean_output_flow :
251251
out = output.decode("utf-8", "ignore").strip()
252252
out = out.split("\n")
@@ -1087,7 +1087,7 @@ def on_recv(self, conn, addr, ip, port):
10871087
if input_from_client_bytes :
10881088

10891089
# decode input and strip the end of line
1090-
input_from_client = input_from_client_bytes.decode("utf8").rstrip()
1090+
input_from_client = input_from_client_bytes.decode("utf8")
10911091

10921092
if self.func_on_recv :
10931093
self.func_on_recv(conn, addr, ip, port, input_from_client, self.clients[ip+":"+str(port)])
@@ -1235,10 +1235,10 @@ def init(self):
12351235
if os.path.exists(node_modules_path):
12361236
shutil.rmtree(node_modules_path)
12371237
sublime.error_message("Error during installation: can not install the npm dependencies for JavaScript Enhancements.")
1238-
else:
1239-
result = npm.update_all()
1240-
if not result[0]:
1241-
sublime.active_window().status_message("Error: JavaScript Enhancements - cannot update npm dependencies.")
1238+
# else:
1239+
# result = npm.update_all()
1240+
# if not result[0]:
1241+
# sublime.active_window().status_message("Error: JavaScript Enhancements - cannot update npm dependencies.")
12421242

12431243
sublime.set_timeout_async(lambda: overwrite_default_javascript_snippet())
12441244

@@ -1745,6 +1745,15 @@ def is_enabled(self) :
17451745
return True
17461746
return False
17471747

1748+
class build_flow_on_save(sublime_plugin.EventListener):
1749+
1750+
def on_post_save_async(self, view):
1751+
settings = get_project_settings()
1752+
if Util.selection_in_js_scope(view) and settings and settings["project_settings"]["build_flow"]["on_save"] and len(settings["project_settings"]["build_flow"]["source_folders"]) > 0 and settings["project_settings"]["build_flow"]["destination_folder"] :
1753+
view.window().run_command("build_flow", args={"command": ["flow-remove-types", ":source_folders", "--out-dir", ":destination_folder"]})
1754+
1755+
1756+
17481757
import sublime, sublime_plugin
17491758
import os, webbrowser, shlex, json, collections
17501759

@@ -2298,7 +2307,7 @@ def _run(self):
22982307
import sublime, sublime_plugin
22992308
import os, webbrowser, shlex, json
23002309

2301-
def yeoman_prepare_project(project_path):
2310+
def yeoman_prepare_project(project_path, type):
23022311

23032312
window = sublime.active_window()
23042313
view = window.new_file()
@@ -2378,15 +2387,13 @@ def project_path_on_done(self, path):
23782387
result = node.execute("flow", ["init"], is_from_bin=True, chdir=path)
23792388
if not result[0]:
23802389
sublime.error_message("Can not init flow.")
2381-
else:
2382-
with open(flowconfig_file_path, 'r+', encoding="utf-8") as file:
2383-
content = file.read()
2384-
content = content.replace("[ignore]", """[ignore]
2385-
<PROJECT_ROOT>/node_modules/.*
2386-
<PROJECT_ROOT>/bower_components/.*""")
2387-
file.seek(0)
2388-
file.truncate()
2389-
file.write(content)
2390+
# else:
2391+
# with open(flowconfig_file_path, 'r+', encoding="utf-8") as file:
2392+
# content = file.read()
2393+
# content = content.replace("[ignore]", """[ignore]""")
2394+
# file.seek(0)
2395+
# file.truncate()
2396+
# file.write(content)
23902397

23912398
Hook.apply(self.project_type+"_after_create_new_project", path, "create_new_project")
23922399
Hook.apply("after_create_new_project", path, "create_new_project")
@@ -2466,7 +2473,7 @@ def on_pre_close(self, view) :
24662473
node = NodeJS()
24672474

24682475
if not sublime.windows() :
2469-
2476+
24702477
sublime.status_message("flow server stopping")
24712478
sublime.set_timeout_async(lambda: node.execute("flow", ["stop"], is_from_bin=True, chdir=os.path.join(PACKAGE_PATH, "flow")))
24722479

@@ -2784,7 +2791,7 @@ def is_visible(self, **args) :
27842791
class JavaScriptCompletions():
27852792

27862793
def get(self, key):
2787-
return sublime.load_settings('settings.sublime-settings').get(key)
2794+
return sublime.load_settings('JavaScript Enhancements.sublime-settings').get(key)
27882795

27892796
javascriptCompletions = JavaScriptCompletions()
27902797

@@ -4613,6 +4620,6 @@ def start():
46134620
mainPlugin.init()
46144621

46154622
def plugin_loaded():
4616-
sublime.set_timeout_async(start)
4623+
sublime.set_timeout_async(start, 1000)
46174624

46184625

helper/evaluate_javascript/Context.sublime-menu

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@
3737
"command": ["-e"],
3838
"is_line": true
3939
}
40-
},
41-
{ "caption": "-" },
42-
{
43-
"caption": "Hide start and end white dot",
44-
"id": "hide_start_end_dot_eval",
45-
"command": "hide_start_end_dot_eval"
46-
},
47-
{
48-
"caption": "Show start and end white dot",
49-
"id": "show_start_end_dot_eval",
50-
"command": "show_start_end_dot_eval"
5140
}
5241
]
5342
},

helper/javascript_completions/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class JavaScriptCompletions():
55

66
def get(self, key):
7-
return sublime.load_settings('settings.sublime-settings').get(key)
7+
return sublime.load_settings('JavaScript Enhancements.sublime-settings').get(key)
88

99
javascriptCompletions = JavaScriptCompletions()
1010

helper/my_socket/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def on_recv(self, conn, addr, ip, port):
152152
if input_from_client_bytes :
153153

154154
# decode input and strip the end of line
155-
input_from_client = input_from_client_bytes.decode("utf8").rstrip()
155+
input_from_client = input_from_client_bytes.decode("utf8")
156156

157157
if self.func_on_recv :
158158
self.func_on_recv(conn, addr, ip, port, input_from_client, self.clients[ip+":"+str(port)])

helper/node/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
NODE_MODULES_BIN_PATH = os.path.join(NODE_MODULES_PATH, ".bin")
1111

1212
def get_node_js_custom_path():
13-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
13+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
1414
if json_file and "node_js_custom_path" in json_file :
1515
return json_file.get("node_js_custom_path").strip()
1616
return ""
1717

1818
def get_npm_custom_path():
19-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
19+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
2020
if json_file and "npm_custom_path" in json_file :
2121
return json_file.get("npm_custom_path").strip()
2222
return ""
2323

2424
def get_yarn_custom_path():
25-
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "settings.sublime-settings"))
25+
json_file = Util.open_json(os.path.join(PACKAGE_PATH, "JavaScript Enhancements.sublime-settings"))
2626
if json_file and "yarn_custom_path" in json_file :
2727
return json_file.get("yarn_custom_path").strip()
2828
return ""
@@ -119,7 +119,7 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
119119

120120
if chdir:
121121
os.chdir(owd)
122-
122+
123123
if clean_output_flow :
124124
out = output.decode("utf-8", "ignore").strip()
125125
out = out.split("\n")

0 commit comments

Comments
 (0)