@@ -137,19 +137,19 @@ def stop(self):
137137NODE_MODULES_BIN_PATH = os .path .join (NODE_MODULES_PATH , ".bin" )
138138
139139def 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
145145def 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
151151def 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+
17481757import sublime , sublime_plugin
17491758import os , webbrowser , shlex , json , collections
17501759
@@ -2298,7 +2307,7 @@ def _run(self):
22982307import sublime , sublime_plugin
22992308import 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) :
27842791class 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
27892796javascriptCompletions = JavaScriptCompletions ()
27902797
@@ -4613,6 +4620,6 @@ def start():
46134620 mainPlugin .init ()
46144621
46154622def plugin_loaded ():
4616- sublime .set_timeout_async (start )
4623+ sublime .set_timeout_async (start , 1000 )
46174624
46184625
0 commit comments