Skip to content

Commit 07df298

Browse files
fix problems on_hover_description, updated README.md, first version testable v0.1.0 released
1 parent 3a850a7 commit 07df298

File tree

9 files changed

+195
-30
lines changed

9 files changed

+195
-30
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
**JavaScript Enhancements** is a plugin for **Sublime Text 3**.
44

5-
I'm implementing new features thanks to **[Flow](https://github.com/facebook/flow)** (javascript static type checker from Facebook).
5+
This plugin uses **[Flow](https://github.com/facebook/flow)** (javascript static type checker from Facebook) under the hood.
66

7-
This is in **Beta version**.
7+
This is in **Beta** version for testing.
88

9-
I'm going to **release** a first testable version these days, so **WATCH** the repository to stay tuned for any news!
10-
11-
It will offer not only a better **javascript autocomplete** but a lot of features about creating,
12-
developing and managing **javascript projects**, such as:
9+
It offers better **javascript autocomplete** and also a lot of features about creating, developing and managing **javascript projects**, such as:
1310

1411
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
1512
- Ionic v1 and v2 projects (same as Cordova projects!)
@@ -23,7 +20,7 @@ developing and managing **javascript projects**, such as:
2320

2421
You could use it also in **existing projects** (see the [Wiki](https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki))!
2522

26-
It will turn Sublime Text into a **JavaScript IDE** like!
23+
It turns Sublime Text into a **JavaScript IDE** like!
2724

2825
This project is based on my other Sublime Text plugin [JavaScript Completions](https://github.com/pichillilorenzo/JavaScript-Completions)
2926

@@ -59,9 +56,9 @@ You can find more information about Flow on [flow.org](https://flow.org)
5956

6057
## Installation
6158

62-
~~With [Package Control](https://packagecontrol.io/):~~
59+
With [Package Control](https://packagecontrol.io/):
6360

64-
~~- Run “Package Control: Install Package” command or click to the `Preferences > Package Control` menu item, find and install `JavaScript Enhancements` plugin.~~
61+
- Run “Package Control: Install Package” command or click to the `Preferences > Package Control` menu item, find and install `JavaScript Enhancements` plugin.
6562

6663
Manually:
6764

_generated_2018_01_01_at_21_08_47.py renamed to _generated_2018_01_02_at_00_50_45.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,6 +3383,10 @@ def on_hover_description_async(self, view, point, hover_zone, popup_position) :
33833383
if hover_zone != sublime.HOVER_TEXT :
33843384
return
33853385

3386+
for region in view.get_regions("flow_error"):
3387+
if region.contains(point):
3388+
return
3389+
33863390
region = view.word(point)
33873391
word = view.substr(region)
33883392
if not word.strip() :
@@ -3567,7 +3571,7 @@ def on_hover_description_async(self, view, point, hover_zone, popup_position) :
35673571

35683572
func_action = lambda x: view.run_command("go_to_def", args={"point": point}) if x == "go_to_def" else ""
35693573

3570-
if html and not view.is_popup_visible() :
3574+
if html:
35713575
view.show_popup("""
35723576
<html><head></head><body>
35733577
"""+js_css+"""
@@ -3988,8 +3992,8 @@ def on_hover(self, point, hover_zone) :
39883992

39893993
row_region, col_region = view.rowcol(region_hover_error.begin())
39903994
row_region, endcol_region = view.rowcol(region_hover_error.end())
3991-
3992-
view.show_popup('<html style="padding: 0px; margin: 0px; background-color: rgba(255,255,255,1);"><body style="font-size: 0.75em; font-weight: bold; padding: 5px; background-color: #F44336; margin: 0px;">'+html+'<br><a style="margin-top: 10px; display: block; color: #000;" href="copy_to_clipboard">Copy</a></body></html>', sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, region_hover_error.begin(), 1150, 80, lambda action: sublime.set_clipboard(error) or view.hide_popup() )
3995+
3996+
view.show_popup('<html style="padding: 0px; margin: 0px; background-color: rgba(255,255,255,1);"><body style="font-size: 0.8em; font-weight: bold; padding: 5px; background-color: #F44336; margin: 0px;">'+html+'<br><a style="margin-top: 10px; display: block; color: #000;" href="copy_to_clipboard">Copy</a></body></html>', sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, region_hover_error.begin(), 1150, 80, lambda action: sublime.set_clipboard(error) or view.hide_popup() )
39933997

39943998
def on_selection_modified_async(self, *args) :
39953999

@@ -4852,10 +4856,16 @@ def start():
48524856
sublime.error_message("Windows is not supported by this plugin for now.")
48534857
return
48544858

4859+
if platform.architecture()[0] != "64bit":
4860+
sublime.error_message("Your architecture is not supported by this plugin. This plugin supports only 64bit architectures.")
4861+
return
4862+
48554863
try:
48564864
sys.modules["TerminalView"]
48574865
except Exception as err:
4858-
sublime.error_message("TerminalView plugin is missing. TerminalView is required to be able to use this plugin.")
4866+
response = sublime.yes_no_cancel_dialog("TerminalView plugin is missing. TerminalView is required to be able to use \"JavaScript Enhancements\" plugin. Do you want open the github repo of it?", "Yes, open it", "No")
4867+
if response == sublime.DIALOG_YES:
4868+
sublime.active_window().run_command("open_url", args={"url": "https://github.com/Wramberg/TerminalView"})
48594869
return
48604870

48614871
try:
@@ -4869,7 +4879,11 @@ def start():
48694879
try:
48704880
node.getCurrentNodeJSVersion()
48714881
except Exception as err:
4872-
sublime.error_message("Error during installation: node.js is not installed on your system.")
4882+
response = sublime.yes_no_cancel_dialog("Error during installation: node.js is not installed on your system. Node.js and npm are required to be able to use JavaScript Enhancements plugin. Do you want open the website of node.js?", "Yes, open it", "Or use nvm")
4883+
if response == sublime.DIALOG_YES:
4884+
sublime.active_window().run_command("open_url", args={"url": "https://nodejs.org"})
4885+
elif response == sublime.DIALOG_NO:
4886+
sublime.active_window().run_command("open_url", args={"url": "https://github.com/creationix/nvm"})
48734887
return
48744888

48754889
mainPlugin.init()
@@ -4879,6 +4893,7 @@ def plugin_loaded():
48794893
if int(sublime.version()) >= 3124 :
48804894
sublime.set_timeout_async(start, 1000)
48814895
else:
4882-
sublime.error_message("JavaScript Enhancements plugin requires Sublime Text 3 (build 3124 or newer). Your version build is: " + sublime.version())
4883-
4896+
response = sublime.yes_no_cancel_dialog("JavaScript Enhancements plugin requires Sublime Text 3 (build 3124 or newer). Your build is: " + sublime.version() + ". Do you want open the download page?", "Yes, open it", "No")
4897+
if response == sublime.DIALOG_YES:
4898+
sublime.active_window().run_command("open_url", args={"url": "https://www.sublimetext.com/3"})
48844899

changelog/0.1.0.txt

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

changelog/install.txt

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,72 @@
1-
JavaScript Enhancements Package
2-
===============================
1+
=================================================================
2+
** THIS PLUGIN IS IN BETA! Thanks for your support in advance! **
3+
=================================================================
34

4-
How To USE
5-
==========
5+
If you like it, remember to star it ⭐ on GitHub: https://github.com/pichillilorenzo/JavaScriptEnhancements
66

7+
** USAGE **
8+
===========
79

10+
See how it works on the Wiki: 👉👉 https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki 👈👈
811

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

helper/javascript_completions/on_hover_description_event_listener.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def on_hover_description_async(self, view, point, hover_zone, popup_position) :
5252
if hover_zone != sublime.HOVER_TEXT :
5353
return
5454

55+
for region in view.get_regions("flow_error"):
56+
if region.contains(point):
57+
return
58+
5559
region = view.word(point)
5660
word = view.substr(region)
5761
if not word.strip() :
@@ -236,7 +240,7 @@ def on_hover_description_async(self, view, point, hover_zone, popup_position) :
236240

237241
func_action = lambda x: view.run_command("go_to_def", args={"point": point}) if x == "go_to_def" else ""
238242

239-
if html and not view.is_popup_visible() :
243+
if html:
240244
view.show_popup("""
241245
<html><head></head><body>
242246
"""+js_css+"""

helper/javascript_completions/show_flow_errors_view_event_listener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ def on_hover(self, point, hover_zone) :
174174

175175
row_region, col_region = view.rowcol(region_hover_error.begin())
176176
row_region, endcol_region = view.rowcol(region_hover_error.end())
177-
178-
view.show_popup('<html style="padding: 0px; margin: 0px; background-color: rgba(255,255,255,1);"><body style="font-size: 0.75em; font-weight: bold; padding: 5px; background-color: #F44336; margin: 0px;">'+html+'<br><a style="margin-top: 10px; display: block; color: #000;" href="copy_to_clipboard">Copy</a></body></html>', sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, region_hover_error.begin(), 1150, 80, lambda action: sublime.set_clipboard(error) or view.hide_popup() )
177+
178+
view.show_popup('<html style="padding: 0px; margin: 0px; background-color: rgba(255,255,255,1);"><body style="font-size: 0.8em; font-weight: bold; padding: 5px; background-color: #F44336; margin: 0px;">'+html+'<br><a style="margin-top: 10px; display: block; color: #000;" href="copy_to_clipboard">Copy</a></body></html>', sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HIDE_ON_MOUSE_MOVE_AWAY, region_hover_error.begin(), 1150, 80, lambda action: sublime.set_clipboard(error) or view.hide_popup() )
179179

180180
def on_selection_modified_async(self, *args) :
181181

make/_init.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@ def start():
106106
sublime.error_message("Windows is not supported by this plugin for now.")
107107
return
108108

109+
if platform.architecture()[0] != "64bit":
110+
sublime.error_message("Your architecture is not supported by this plugin. This plugin supports only 64bit architectures.")
111+
return
112+
109113
try:
110114
sys.modules["TerminalView"]
111115
except Exception as err:
112-
sublime.error_message("TerminalView plugin is missing. TerminalView is required to be able to use this plugin.")
116+
response = sublime.yes_no_cancel_dialog("TerminalView plugin is missing. TerminalView is required to be able to use \"JavaScript Enhancements\" plugin. Do you want open the github repo of it?", "Yes, open it", "No")
117+
if response == sublime.DIALOG_YES:
118+
sublime.active_window().run_command("open_url", args={"url": "https://github.com/Wramberg/TerminalView"})
113119
return
114120

115121
try:
@@ -123,7 +129,11 @@ def start():
123129
try:
124130
node.getCurrentNodeJSVersion()
125131
except Exception as err:
126-
sublime.error_message("Error during installation: node.js is not installed on your system.")
132+
response = sublime.yes_no_cancel_dialog("Error during installation: node.js is not installed on your system. Node.js and npm are required to be able to use JavaScript Enhancements plugin. Do you want open the website of node.js?", "Yes, open it", "Or use nvm")
133+
if response == sublime.DIALOG_YES:
134+
sublime.active_window().run_command("open_url", args={"url": "https://nodejs.org"})
135+
elif response == sublime.DIALOG_NO:
136+
sublime.active_window().run_command("open_url", args={"url": "https://github.com/creationix/nvm"})
127137
return
128138

129139
mainPlugin.init()
@@ -133,5 +143,6 @@ def plugin_loaded():
133143
if int(sublime.version()) >= 3124 :
134144
sublime.set_timeout_async(start, 1000)
135145
else:
136-
sublime.error_message("JavaScript Enhancements plugin requires Sublime Text 3 (build 3124 or newer). Your version build is: " + sublime.version())
137-
146+
response = sublime.yes_no_cancel_dialog("JavaScript Enhancements plugin requires Sublime Text 3 (build 3124 or newer). Your build is: " + sublime.version() + ". Do you want open the download page?", "Yes, open it", "No")
147+
if response == sublime.DIALOG_YES:
148+
sublime.active_window().run_command("open_url", args={"url": "https://www.sublimetext.com/3"})

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"install": "changelog/install.txt"
2+
"install": "changelog/install.txt",
3+
"0.1.0": "changelog/0.1.0.txt"
34
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"id": "tools", "children": [{"id": "npm_scripts", "children": [], "caption": "Npm/Yarn Scripts"}], "caption": "Tools"}]
1+
[{"caption": "Tools", "children": [{"caption": "Npm/Yarn Scripts", "children": [], "id": "npm_scripts"}], "id": "tools"}]

0 commit comments

Comments
 (0)