Skip to content

Commit 203bf21

Browse files
trying to fix 'Not checking non-flow files' issue
1 parent d9f5780 commit 203bf21

File tree

6 files changed

+136
-10
lines changed

6 files changed

+136
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Manually:
6969

7070
If the plugin gives to you message errors like `Error during installation: "node.js" seems not installed on your system...` but instead you have installed node.js and npm (for example using [nvm](https://github.com/creationix/nvm)), then you could try to set your custom path in the [Global settings](https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Global-settings) of the plugin and then restart Sublime Text.
7171

72-
If this not works too, then you could try to add the custom path that contains binaries of node.js and npm in the **`PATH`** key-value on the same JavaScript Enhancements settings file. This variable will be **appended** to the **$PATH** environment variable, so you could use the same syntax in it. After that you need to restart Sublime Text. Example of a global setting for `Linux` that uses `nvm`:
72+
If this doesn't work too, then you could try to add the custom path that contains binaries of node.js and npm in the **`PATH`** key-value on the same JavaScript Enhancements settings file. This variable will be **appended** to the **$PATH** environment variable, so you could use the same syntax in it. After this you need to restart Sublime Text. Example of a global setting for `Linux` that uses `nvm`:
7373

7474
```
7575
{

_generated_2018_01_03_at_03_39_39.py renamed to _generated_2018_01_03_at_13_27_16.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,16 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
212212

213213
args = ( shlex.quote(self.node_js_path)+" " if use_node else "") +shlex.quote(os.path.join((bin_path or NODE_MODULES_BIN_PATH), command))+" "+command_args+(" < "+shlex.quote(fp.name) if fp and not use_only_filename_view_flow else "")
214214

215-
#print(args)
215+
#print(args)
216+
217+
old_env = os.environ.copy()
218+
219+
new_env = old_env.copy()
220+
new_env["PATH"] = new_env["PATH"] + javascriptCompletions.get("PATH")
221+
222+
# update the PATH environment variable
223+
os.environ.update(new_env)
224+
216225
try:
217226
output = None
218227
result = None
@@ -224,7 +233,10 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
224233
output = subprocess.check_output(
225234
args, shell=True, stderr=subprocess.STDOUT
226235
)
227-
236+
237+
# reset the PATH environment variable
238+
os.environ.update(old_env)
239+
228240
if chdir:
229241
os.chdir(owd)
230242

@@ -266,7 +278,11 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
266278
fp.close()
267279
return [True, result]
268280
except subprocess.CalledProcessError as e:
269-
#print(traceback.format_exc())
281+
print(traceback.format_exc())
282+
283+
# reset the PATH environment variable
284+
os.environ.update(old_env)
285+
270286
try:
271287
result = json.loads(output.decode("utf-8", "ignore")) if is_output_json else output.decode("utf-8", "ignore")
272288
if use_fp_temp :
@@ -279,6 +295,10 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
279295

280296
return [False, None]
281297
except:
298+
299+
# reset the PATH environment variable
300+
os.environ.update(old_env)
301+
282302
print(traceback.format_exc())
283303
if use_fp_temp :
284304
fp.close()
@@ -1226,14 +1246,15 @@ def init(self):
12261246
node_modules_path = os.path.join(PACKAGE_PATH, "node_modules")
12271247
npm = NPM()
12281248
if not os.path.exists(node_modules_path):
1249+
sublime.active_window().status_message("JavaScript Enhancements - installing npm dependencies...")
12291250
result = npm.install_all()
12301251
if result[0]:
12311252
sublime.active_window().status_message("JavaScript Enhancements - npm dependencies installed correctly.")
12321253
else:
12331254
print(result)
12341255
if os.path.exists(node_modules_path):
12351256
shutil.rmtree(node_modules_path)
1236-
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js and npm in way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.")
1257+
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js and npm in a way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.")
12371258
# else:
12381259
# result = npm.update_all()
12391260
# if not result[0]:
@@ -4867,10 +4888,12 @@ def start():
48674888
global mainPlugin
48684889

48694890
if sublime.platform() == 'windows':
4891+
print(sublime.platform())
48704892
sublime.error_message("Windows is not supported by this plugin for now.")
48714893
return
48724894

48734895
if platform.architecture()[0] != "64bit":
4896+
print(platform.architecture())
48744897
sublime.error_message("Your architecture is not supported by this plugin. This plugin supports only 64bit architectures.")
48754898
return
48764899

changelog/0.1.12.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
v0.1.12
2+
3+
## Fixes
4+
5+
- Trying to fix "Not checking non-flow files" #7
6+
7+
8+
=================================================================
9+
** THIS PLUGIN IS IN BETA! Thanks for your support in advance! **
10+
=================================================================
11+
12+
If you like it, remember to star it ⭐ on GitHub: https://github.com/pichillilorenzo/JavaScriptEnhancements
13+
14+
** USAGE **
15+
===========
16+
17+
See how it works on the Wiki: 👉👉 https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki 👈👈
18+
19+
20+
** WHAT IS THIS? **
21+
===================
22+
23+
This plugin uses Flow (javascript static type checker from Facebook) under the hood.
24+
25+
It offers better javascript autocomplete and a lot of features about creating,
26+
developing and managing javascript projects, such as:
27+
28+
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
29+
- Ionic v1 and v2 projects (same as Cordova projects!)
30+
- Angular v1 and v2 projects
31+
- React projects
32+
- Express projects
33+
- Yeoman generators
34+
- Local bookmarks project
35+
- JavaScript real-time errors
36+
- etc.
37+
38+
You could use it also in existing projects (see the Wiki - https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Using-it-with-an-existing-project)!
39+
40+
It turns Sublime Text into a JavaScript IDE like!
41+
42+
This project is based on my other Sublime Text plugin JavaScript Completions (https://github.com/pichillilorenzo/JavaScript-Completions)
43+
44+
** NOTE **
45+
If you want use this plugin, you may want uninstall/disable the JavaScript Completions plugin, if installed.
46+
47+
** OS SUPPORTED NOW **
48+
======================
49+
50+
👉 Linux (64-bit)
51+
👉 Mac OS X
52+
53+
❗❗ Dependencies ❗❗
54+
=======================
55+
56+
In order to work properly, this plugin has some dependencies:
57+
58+
👉 Sublime Text 3 (build 3124 or newer)
59+
👉 Node.js and npm (https://nodejs.org or nvm (https://github.com/creationix/nvm))
60+
👉 TerminalView sublime text plugin (https://github.com/Wramberg/TerminalView)
61+
62+
Not required, but useful for typescript files (Flow wont work on this type of files):
63+
64+
👉 TypeScript sublime text plugin (https://github.com/Microsoft/TypeScript-Sublime-Plugin)
65+
66+
** Flow Requirements **
67+
=======================
68+
69+
It use [Flow](https://github.com/facebook/flow) for type checking and auto-completions.
70+
71+
👉 Mac OS X
72+
👉 Linux (64-bit)
73+
👉 Windows (64-bit)
74+
75+
Email me for any questions or doubts about this new project on: [email protected]
76+
77+
Thanks for your support! 😄😄
78+
79+
MIT License

helper/node/main.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,16 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
8686

8787
args = ( shlex.quote(self.node_js_path)+" " if use_node else "") +shlex.quote(os.path.join((bin_path or NODE_MODULES_BIN_PATH), command))+" "+command_args+(" < "+shlex.quote(fp.name) if fp and not use_only_filename_view_flow else "")
8888

89-
#print(args)
89+
#print(args)
90+
91+
old_env = os.environ.copy()
92+
93+
new_env = old_env.copy()
94+
new_env["PATH"] = new_env["PATH"] + javascriptCompletions.get("PATH")
95+
96+
# update the PATH environment variable
97+
os.environ.update(new_env)
98+
9099
try:
91100
output = None
92101
result = None
@@ -98,7 +107,10 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
98107
output = subprocess.check_output(
99108
args, shell=True, stderr=subprocess.STDOUT
100109
)
101-
110+
111+
# reset the PATH environment variable
112+
os.environ.update(old_env)
113+
102114
if chdir:
103115
os.chdir(owd)
104116

@@ -140,7 +152,11 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
140152
fp.close()
141153
return [True, result]
142154
except subprocess.CalledProcessError as e:
143-
#print(traceback.format_exc())
155+
print(traceback.format_exc())
156+
157+
# reset the PATH environment variable
158+
os.environ.update(old_env)
159+
144160
try:
145161
result = json.loads(output.decode("utf-8", "ignore")) if is_output_json else output.decode("utf-8", "ignore")
146162
if use_fp_temp :
@@ -153,6 +169,10 @@ def execute_check_output(self, command, command_args, is_from_bin=False, use_fp_
153169

154170
return [False, None]
155171
except:
172+
173+
# reset the PATH environment variable
174+
os.environ.update(old_env)
175+
156176
print(traceback.format_exc())
157177
if use_fp_temp :
158178
fp.close()

make/_init.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ def init(self):
7171
node_modules_path = os.path.join(PACKAGE_PATH, "node_modules")
7272
npm = NPM()
7373
if not os.path.exists(node_modules_path):
74+
sublime.active_window().status_message("JavaScript Enhancements - installing npm dependencies...")
7475
result = npm.install_all()
7576
if result[0]:
7677
sublime.active_window().status_message("JavaScript Enhancements - npm dependencies installed correctly.")
7778
else:
7879
print(result)
7980
if os.path.exists(node_modules_path):
8081
shutil.rmtree(node_modules_path)
81-
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js and npm in way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.")
82+
sublime.error_message("Error during installation: can't install npm dependencies for JavaScript Enhancements plugin.\n\nThe error COULD be caused by the npm permission access (EACCES error), so in this case you need to repair/install node.js and npm in a way that doesn't require \"sudo\" command.\n\nFor example you could use a Node Version Manager, such as \"nvm\" or \"nodenv\".\n\nTry to run \"npm install\" inside the package of this plugin to see what you get.")
8283
# else:
8384
# result = npm.update_all()
8485
# if not result[0]:
@@ -104,10 +105,12 @@ def start():
104105
global mainPlugin
105106

106107
if sublime.platform() == 'windows':
108+
print(sublime.platform())
107109
sublime.error_message("Windows is not supported by this plugin for now.")
108110
return
109111

110112
if platform.architecture()[0] != "64bit":
113+
print(platform.architecture())
111114
sublime.error_message("Your architecture is not supported by this plugin. This plugin supports only 64bit architectures.")
112115
return
113116

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"0.1.0": "changelog/0.1.0.txt",
44
"0.1.01": "changelog/0.1.01.txt",
55
"0.1.10": "changelog/0.1.10.txt",
6-
"0.1.11": "changelog/0.1.11.txt"
6+
"0.1.11": "changelog/0.1.11.txt",
7+
"0.1.12": "changelog/0.1.12.txt"
78
}

0 commit comments

Comments
 (0)