Skip to content

Commit 032656f

Browse files
bug fixes, updated README.md
1 parent d54ce6b commit 032656f

File tree

13 files changed

+101
-70
lines changed

13 files changed

+101
-70
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ developing and managing **javascript projects**, such as:
1717
- Ionic v1 and v2 projects (same as Cordova projects!)
1818
- Angular v1 and v2 projects
1919
- React projects
20-
- Node.js projects
20+
- Express projects
2121
- Yeoman generators
2222
- Local bookmarks project
23-
- JavaScript errors with Flow
23+
- JavaScript real-time errors
2424
- etc.
2525

2626
It will turn Sublime Text into a **JavaScript IDE** like!
@@ -59,9 +59,22 @@ You can find more information about Flow on [flow.org](https://flow.org)
5959
## Usage
6060
[Wiki](https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki) in progress.
6161

62+
## Quick Overview
63+
64+
### Autocompletions
65+
![](https://drive.google.com/uc?authuser=0&id=1NZYWq4kOx9l93zxN7A9TEMUv0VcLfWrt&export=download)
66+
67+
### Errors
68+
![](https://drive.google.com/uc?authuser=0&id=1r8IDItL03tPFwCCsTIdW54rRpascnHAF&export=download)
69+
70+
### Project with terminal
71+
![](https://drive.google.com/uc?authuser=0&id=1gmC6GROJXyhV8DZTHw8Zw_KGlB13g_bL&export=download)
72+
![](https://drive.google.com/uc?authuser=0&id=1Y0NS1eb8aFoxhdn75JLoGgZMPPpqld3Z&export=download)
73+
![](https://drive.google.com/uc?authuser=0&id=1lHXQGN3CoV5-IHAoesEmkiJBjnpU2Lxf&export=download)
74+
6275
## Support
6376

64-
Email me for any questions or doubts about this project on: [[email protected]](mailto:[email protected])
77+
Email me for any Feature proposal, questions or doubts about this project on: [[email protected]](mailto:[email protected])
6578

6679
Thanks for your support!!!
6780

_generated_2017_12_29_at_23_44_53.py renamed to _generated_2017_12_30_at_15_34_17.py

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
PLATFORM = platform_switcher.get(sublime.platform())
2525
PLATFORM_ARCHITECTURE = "64bit" if platform.architecture()[0] == "64bit" else "32bit"
2626

27-
#PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'express', 'ionicv1', 'ionicv2', 'node.js', 'react', 'yeoman']
27+
#PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'express', 'ionicv1', 'ionicv2', 'react', 'yeoman']
2828
PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'ionicv1', 'ionicv2', 'react', 'yeoman']
2929

3030
class Hook(object):
@@ -1196,13 +1196,18 @@ def close(self) :
11961196
self.socket = None
11971197

11981198

1199-
def subl(args):
1200-
1199+
def sublime_executable_path():
12011200
executable_path = sublime.executable_path()
12021201
if sublime.platform() == 'osx':
12031202
app_path = executable_path[:executable_path.rfind(".app/") + 5]
12041203
executable_path = app_path + "Contents/SharedSupport/bin/subl"
12051204

1205+
return executable_path
1206+
1207+
def subl(args):
1208+
1209+
executable_path = sublime_executable_path()
1210+
12061211
if sublime.platform() == 'windows' :
12071212
args = [executable_path] + args
12081213
else :
@@ -1601,12 +1606,10 @@ def _run(self):
16011606

16021607
args = {"cmd": cmd, "title": "JavaScript Enhancements Terminal", "cwd": self.working_directory, "syntax": None, "keep_open": False}
16031608
view.run_command('terminal_view_activate', args=args)
1604-
1605-
# stop the current process with SIGINT
1606-
self.window.run_command("terminal_view_send_string", args={"string": "\x03"})
16071609

1608-
# call command
1609-
self.window.run_command("terminal_view_send_string", args={"string": self.path_cli+" "+(" ".join(self.command))+"\n"})
1610+
# stop the current process with SIGINT and call the command
1611+
sublime.set_timeout_async(lambda: self.window.run_command("terminal_view_send_string", args={"string": "\x03"}) or
1612+
self.window.run_command("terminal_view_send_string", args={"string": self.path_cli+" "+(" ".join(self.command))+"\n"}), 500)
16101613

16111614
def substitute_placeholders(self, variable):
16121615

@@ -1795,16 +1798,17 @@ def cordova_prepare_project(project_path, cordova_custom_path):
17951798
view = window.new_file()
17961799

17971800
if sublime.platform() in ("linux", "osx"):
1801+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
17981802
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
17991803
view.run_command('terminal_view_activate', args=args)
1800-
window.run_command("terminal_view_send_string", args={"string": cordova_custom_path+" create temp com.example.hello HelloWorld && mv ./temp/{.[!.],}* ./ && rm -rf temp\n"})
1804+
window.run_command("terminal_view_send_string", args={"string": cordova_custom_path+" create myApp com.example.hello HelloWorld && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
18011805
else:
18021806
# windows
18031807
pass
18041808

18051809
add_cordova_settings(project_path, cordova_custom_path)
18061810

1807-
open_project_folder(get_project_settings()["project_file_name"])
1811+
#open_project_folder(get_project_settings(project_path)["project_file_name"])
18081812

18091813
Hook.add("cordova_after_create_new_project", cordova_ask_custom_path)
18101814
Hook.add("cordova_add_javascript_project_configuration", cordova_ask_custom_path)
@@ -1892,17 +1896,16 @@ def ionicv1_prepare_project(project_path, ionicv1_custom_path):
18921896
view = window.new_file()
18931897

18941898
if sublime.platform() in ("linux", "osx"):
1899+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
18951900
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
18961901
view.run_command('terminal_view_activate', args=args)
1897-
window.run_command("terminal_view_send_string", args={"string": ionicv1_custom_path+" start myApp blank --type ionic1 && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
1902+
window.run_command("terminal_view_send_string", args={"string": ionicv1_custom_path+" start myApp blank --type ionic1 && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
18981903
else:
18991904
# windows
19001905
pass
19011906

19021907
add_ionicv1_settings(project_path, ionicv1_custom_path)
19031908

1904-
open_project_folder(get_project_settings()["project_file_name"])
1905-
19061909
Hook.add("ionicv1_after_create_new_project", ionicv1_ask_custom_path)
19071910
Hook.add("ionicv1_add_javascript_project_configuration", ionicv1_ask_custom_path)
19081911

@@ -1990,17 +1993,16 @@ def ionicv2_prepare_project(project_path, ionicv2_custom_path):
19901993
view = window.new_file()
19911994

19921995
if sublime.platform() in ("linux", "osx"):
1996+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
19931997
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
19941998
view.run_command('terminal_view_activate', args=args)
1995-
window.run_command("terminal_view_send_string", args={"string": ionicv2_custom_path+" start myApp && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
1999+
window.run_command("terminal_view_send_string", args={"string": ionicv2_custom_path+" start myApp && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
19962000
else:
19972001
# windows
19982002
pass
19992003

20002004
add_ionicv2_settings(project_path, ionicv2_custom_path)
20012005

2002-
open_project_folder(get_project_settings()["project_file_name"])
2003-
20042006
Hook.add("ionicv2_after_create_new_project", ionicv2_ask_custom_path)
20052007
Hook.add("ionicv2_add_javascript_project_configuration", ionicv2_ask_custom_path)
20062008

@@ -2029,14 +2031,18 @@ def platform_on_done(self, platform):
20292031

20302032
def _run(self):
20312033
try:
2032-
self.command = {
2033-
'run': lambda : self.command + self.settings["ionicv2_settings"]["platform_run_options"][self.command[3].replace('--', '')][self.command[2]],
2034-
'compile': lambda : self.command + self.settings["ionicv2_settings"]["platform_compile_options"][self.command[3].replace('--', '')][self.command[2]],
2035-
'build': lambda : self.command + self.settings["ionicv2_settings"]["platform_build_options"][self.command[3].replace('--', '')][self.command[2]],
2036-
'emulate': lambda : self.command + self.settings["ionicv2_settings"]["platform_emulate_options"][self.command[3].replace('--', '')][self.command[2]],
2037-
'prepare': lambda : self.command + self.settings["ionicv2_settings"]["platform_prepare_options"][self.command[2]],
2038-
'serve': lambda : self.command + self.settings["ionicv2_settings"]["serve_options"]
2039-
}[self.command[1]]()
2034+
if self.command[0] == "cordova":
2035+
self.command = {
2036+
'run': lambda : self.command + self.settings["ionicv2_settings"]["platform_run_options"][self.command[3].replace('--', '')][self.command[2]],
2037+
'compile': lambda : self.command + self.settings["ionicv2_settings"]["platform_compile_options"][self.command[3].replace('--', '')][self.command[2]],
2038+
'build': lambda : self.command + self.settings["ionicv2_settings"]["platform_build_options"][self.command[3].replace('--', '')][self.command[2]],
2039+
'emulate': lambda : self.command + self.settings["ionicv2_settings"]["platform_emulate_options"][self.command[3].replace('--', '')][self.command[2]],
2040+
'prepare': lambda : self.command + self.settings["ionicv2_settings"]["platform_prepare_options"][self.command[2]]
2041+
}[self.command[1]]()
2042+
else:
2043+
self.command = {
2044+
'serve': lambda : self.command + self.settings["ionicv2_settings"]["serve_options"]
2045+
}[self.command[0]]()
20402046
except KeyError as err:
20412047
pass
20422048
except Exception as err:
@@ -2084,9 +2090,10 @@ def angularv1_prepare_project(project_path, angularv1_custom_path):
20842090
view = window.new_file()
20852091

20862092
if sublime.platform() in ("linux", "osx"):
2093+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
20872094
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
20882095
view.run_command('terminal_view_activate', args=args)
2089-
window.run_command("terminal_view_send_string", args={"string": angularv1_custom_path+" angular\n"})
2096+
window.run_command("terminal_view_send_string", args={"string": angularv1_custom_path+" angular" + open_project + "\n"})
20902097
else:
20912098
# windows
20922099
pass
@@ -2173,9 +2180,10 @@ def angularv2_prepare_project(project_path, angularv2_custom_path):
21732180
view = window.new_file()
21742181

21752182
if sublime.platform() in ("linux", "osx"):
2183+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
21762184
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
21772185
view.run_command('terminal_view_activate', args=args)
2178-
window.run_command("terminal_view_send_string", args={"string": angularv2_custom_path+" new myApp && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
2186+
window.run_command("terminal_view_send_string", args={"string": angularv2_custom_path+" new myApp && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
21792187
else:
21802188
# windows
21812189
pass
@@ -2269,17 +2277,16 @@ def react_prepare_project(project_path, react_custom_path):
22692277
view = window.new_file()
22702278

22712279
if sublime.platform() in ("linux", "osx"):
2280+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
22722281
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
22732282
view.run_command('terminal_view_activate', args=args)
2274-
window.run_command("terminal_view_send_string", args={"string": react_custom_path+" myApp && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
2283+
window.run_command("terminal_view_send_string", args={"string": react_custom_path+" myApp && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
22752284
else:
22762285
# windows
22772286
pass
22782287

22792288
add_react_settings(project_path, react_custom_path)
22802289

2281-
open_project_folder(get_project_settings()["project_file_name"])
2282-
22832290
Hook.add("react_after_create_new_project", react_ask_custom_path)
22842291
Hook.add("react_add_javascript_project_configuration", react_ask_custom_path)
22852292

@@ -2313,15 +2320,14 @@ def yeoman_prepare_project(project_path, type):
23132320
view = window.new_file()
23142321

23152322
if sublime.platform() in ("linux", "osx"):
2323+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
23162324
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
23172325
view.run_command('terminal_view_activate', args=args)
2318-
window.run_command("terminal_view_send_string", args={"string": "yo\n"})
2326+
window.run_command("terminal_view_send_string", args={"string": "yo" + open_project + "\n"})
23192327
else:
23202328
# windows
23212329
pass
23222330

2323-
open_project_folder(get_project_settings()["project_file_name"])
2324-
23252331
Hook.add("yeoman_after_create_new_project", yeoman_prepare_project)
23262332

23272333

@@ -2345,7 +2351,7 @@ def project_path_on_done(self, path):
23452351

23462352
path = shlex.quote( path.strip() )
23472353

2348-
if os.path.exists(os.path.join(path, PROJECT_SETTINGS_FOLDER_NAME)):
2354+
if os.path.isdir(os.path.join(path, PROJECT_SETTINGS_FOLDER_NAME)):
23492355
sublime.error_message(path+" is not empty. Can not create the project.")
23502356
return
23512357

@@ -2398,6 +2404,9 @@ def project_path_on_done(self, path):
23982404
Hook.apply(self.project_type+"_after_create_new_project", path, "create_new_project")
23992405
Hook.apply("after_create_new_project", path, "create_new_project")
24002406

2407+
if self.project_type == "empty":
2408+
open_project_folder(get_project_settings(path)["project_file_name"])
2409+
24012410
class add_javascript_project_typeCommand(sublime_plugin.WindowCommand):
24022411
project_type = None
24032412
settings = None

make/_init.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
PLATFORM = platform_switcher.get(sublime.platform())
2525
PLATFORM_ARCHITECTURE = "64bit" if platform.architecture()[0] == "64bit" else "32bit"
2626

27-
#PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'express', 'ionicv1', 'ionicv2', 'node.js', 'react', 'yeoman']
27+
#PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'express', 'ionicv1', 'ionicv2', 'react', 'yeoman']
2828
PROJECT_TYPE_SUPPORTED = ['empty', 'angularv1', 'angularv2', 'cordova', 'ionicv1', 'ionicv2', 'react', 'yeoman']
2929

3030
${include ./helper/Hook.py}
@@ -35,13 +35,18 @@
3535
${include ./helper/util/main.py}
3636
${include ./helper/my_socket/main.py}
3737

38-
def subl(args):
39-
38+
def sublime_executable_path():
4039
executable_path = sublime.executable_path()
4140
if sublime.platform() == 'osx':
4241
app_path = executable_path[:executable_path.rfind(".app/") + 5]
4342
executable_path = app_path + "Contents/SharedSupport/bin/subl"
4443

44+
return executable_path
45+
46+
def subl(args):
47+
48+
executable_path = sublime_executable_path()
49+
4550
if sublime.platform() == 'windows' :
4651
args = [executable_path] + args
4752
else :

project/angularv1/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def angularv1_prepare_project(project_path, angularv1_custom_path):
3535
view = window.new_file()
3636

3737
if sublime.platform() in ("linux", "osx"):
38+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
3839
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
3940
view.run_command('terminal_view_activate', args=args)
40-
window.run_command("terminal_view_send_string", args={"string": angularv1_custom_path+" angular\n"})
41+
window.run_command("terminal_view_send_string", args={"string": angularv1_custom_path+" angular" + open_project + "\n"})
4142
else:
4243
# windows
4344
pass

project/angularv2/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def angularv2_prepare_project(project_path, angularv2_custom_path):
3535
view = window.new_file()
3636

3737
if sublime.platform() in ("linux", "osx"):
38+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
3839
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
3940
view.run_command('terminal_view_activate', args=args)
40-
window.run_command("terminal_view_send_string", args={"string": angularv2_custom_path+" new myApp && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
41+
window.run_command("terminal_view_send_string", args={"string": angularv2_custom_path+" new myApp && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
4142
else:
4243
# windows
4344
pass

project/cordova/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ def cordova_prepare_project(project_path, cordova_custom_path):
3939
view = window.new_file()
4040

4141
if sublime.platform() in ("linux", "osx"):
42+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
4243
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
4344
view.run_command('terminal_view_activate', args=args)
44-
window.run_command("terminal_view_send_string", args={"string": cordova_custom_path+" create temp com.example.hello HelloWorld && mv ./temp/{.[!.],}* ./ && rm -rf temp\n"})
45+
window.run_command("terminal_view_send_string", args={"string": cordova_custom_path+" create myApp com.example.hello HelloWorld && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
4546
else:
4647
# windows
4748
pass
4849

4950
add_cordova_settings(project_path, cordova_custom_path)
5051

51-
open_project_folder(get_project_settings()["project_file_name"])
52+
#open_project_folder(get_project_settings(project_path)["project_file_name"])
5253

5354
Hook.add("cordova_after_create_new_project", cordova_ask_custom_path)
5455
Hook.add("cordova_add_javascript_project_configuration", cordova_ask_custom_path)

project/create_new_project/create_new_project.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def project_path_on_done(self, path):
1717

1818
path = shlex.quote( path.strip() )
1919

20-
if os.path.exists(os.path.join(path, PROJECT_SETTINGS_FOLDER_NAME)):
20+
if os.path.isdir(os.path.join(path, PROJECT_SETTINGS_FOLDER_NAME)):
2121
sublime.error_message(path+" is not empty. Can not create the project.")
2222
return
2323

@@ -70,6 +70,9 @@ def project_path_on_done(self, path):
7070
Hook.apply(self.project_type+"_after_create_new_project", path, "create_new_project")
7171
Hook.apply("after_create_new_project", path, "create_new_project")
7272

73+
if self.project_type == "empty":
74+
open_project_folder(get_project_settings(path)["project_file_name"])
75+
7376
class add_javascript_project_typeCommand(sublime_plugin.WindowCommand):
7477
project_type = None
7578
settings = None

project/ionicv1/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,16 @@ def ionicv1_prepare_project(project_path, ionicv1_custom_path):
3939
view = window.new_file()
4040

4141
if sublime.platform() in ("linux", "osx"):
42+
open_project = (" && " + shlex.quote(sublime_executable_path()) + " " +shlex.quote(get_project_settings(project_path)["project_file_name"])) if not is_project_open(get_project_settings(project_path)["project_file_name"]) else ""
4243
args = {"cmd": "/bin/bash -l", "title": "Terminal", "cwd": project_path, "syntax": None, "keep_open": False}
4344
view.run_command('terminal_view_activate', args=args)
44-
window.run_command("terminal_view_send_string", args={"string": ionicv1_custom_path+" start myApp blank --type ionic1 && mv ./myApp/{.[!.],}* ./ && rm -rf myApp\n"})
45+
window.run_command("terminal_view_send_string", args={"string": ionicv1_custom_path+" start myApp blank --type ionic1 && mv ./myApp/{.[!.],}* ./; rm -rf myApp" + open_project + "\n"})
4546
else:
4647
# windows
4748
pass
4849

4950
add_ionicv1_settings(project_path, ionicv1_custom_path)
5051

51-
open_project_folder(get_project_settings()["project_file_name"])
52-
5352
Hook.add("ionicv1_after_create_new_project", ionicv1_ask_custom_path)
5453
Hook.add("ionicv1_add_javascript_project_configuration", ionicv1_ask_custom_path)
5554

0 commit comments

Comments
 (0)