Skip to content

Commit 9ebb3f5

Browse files
fix #8, fix #18, fix #17, fix on_hover_description tooltip on a quoted strings or numeric constants
1 parent c301ac7 commit 9ebb3f5

File tree

12 files changed

+140
-43
lines changed

12 files changed

+140
-43
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ It offers better **javascript autocomplete** and also a lot of features about cr
1616
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
1717
- Ionic v1 and v2 projects (same as Cordova projects!)
1818
- Angular v1 and v2 projects
19-
- React projects (only about the creation at this time)
20-
- React Native projects (only about the creation at this time. I will add also **NativeScript** support)
21-
- Express projects (only about the creation at this time)
19+
- React projects (only about the creation at this moment)
20+
- React Native projects (only about the creation at this moment. I will add also **NativeScript** support)
21+
- Express projects (only about the creation at this moment)
2222
- Yeoman generators
2323
- Local bookmarks project
2424
- JavaScript real-time errors
@@ -63,7 +63,7 @@ You can find more information about Flow on [flow.org](https://flow.org)
6363

6464
## Installation
6565

66-
With [Package Control](https://packagecontrol.io/) (**NOT PUBLISHED YET**):
66+
With [Package Control](https://packagecontrol.io/):
6767

6868
- Run “Package Control: Install Package” command or click to the `Preferences > Package Control` menu item, find and install `JavaScript Enhancements` plugin.
6969

_generated_2018_01_17_at_02_32_47.py renamed to _generated_2018_01_22_at_20_19_53.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from shutil import copyfile
44
from threading import Timer
55

6-
PLUGIN_VERSION = "0.13.11"
6+
PLUGIN_VERSION = "0.13.12"
77

88
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
99
PACKAGE_NAME = os.path.basename(PACKAGE_PATH)
@@ -723,20 +723,20 @@ def trim_Region(view, region):
723723

724724
@staticmethod
725725
def selection_in_js_scope(view, point = -1, except_for = ""):
726-
selections = view.sel()
726+
try :
727727

728-
if not selections:
729-
return False
728+
sel_begin = view.sel()[0].begin() if point == -1 else point
730729

731-
sel_begin = selections[0].begin() if point == -1 else point
730+
return view.match_selector(
731+
sel_begin,
732+
'source.js ' + except_for
733+
) or view.match_selector(
734+
sel_begin,
735+
'source.js.embedded.html ' + except_for
736+
)
732737

733-
return view.match_selector(
734-
sel_begin,
735-
'source.js ' + except_for
736-
) or view.match_selector(
737-
sel_begin,
738-
'source.js.embedded.html ' + except_for
739-
)
738+
except IndexError as e:
739+
return False
740740

741741
@staticmethod
742742
def replace_with_tab(view, region, pre="", after="", add_to_each_line_before="", add_to_each_line_after="") :
@@ -1660,7 +1660,7 @@ def run(self, **kwargs):
16601660
if not self.command:
16611661
self.command = kwargs.get("command")
16621662
else:
1663-
self.command += kwargs.get("command")
1663+
self.command += [kwargs.get("command")]
16641664

16651665
self.prepare_command(**kwargs)
16661666

@@ -1689,7 +1689,7 @@ def run(self, **kwargs):
16891689
if not self.command:
16901690
self.command = kwargs.get("command")
16911691
else:
1692-
self.command += kwargs.get("command")
1692+
self.command += [kwargs.get("command")]
16931693

16941694
self.prepare_command(**kwargs)
16951695

@@ -4094,7 +4094,7 @@ class on_hover_descriptionEventListener(sublime_plugin.EventListener):
40944094
def on_hover(self, view, point, hover_zone) :
40954095
if not view.match_selector(
40964096
point,
4097-
'source.js - comment'
4097+
'source.js - string - constant - comment'
40984098
):
40994099
return
41004100

@@ -4255,6 +4255,7 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
42554255

42564256
if result[0] and result[1].get("type") and result[1]["type"] != "(unknown)":
42574257

4258+
print(result[1])
42584259
results_found = 1
42594260

42604261
description = dict()
@@ -5584,7 +5585,7 @@ def on_modified_async_with_thread(self, recheck=True):
55845585

55855586
repetitions[variableName] = [variableRegion]
55865587

5587-
items = Util.nested_lookup("type", ["MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body)
5588+
items = Util.nested_lookup("type", ["VariableDeclarator", "MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body)
55885589
for item in items:
55895590

55905591
if "object" in item :
@@ -5635,6 +5636,9 @@ def on_modified_async_with_thread(self, recheck=True):
56355636
elif "value" in item and isinstance(item["value"],dict) and "name" in item["value"] and item["value"]["type"] == "Identifier":
56365637
item = item["value"]
56375638

5639+
elif "init" in item and isinstance(item["init"],dict) and "name" in item["init"] and item["init"]["type"] == "Identifier":
5640+
item = item["init"]
5641+
56385642
elif "body" in item and isinstance(item["body"],dict) and "name" in item["body"] and item["body"]["type"] == "Identifier":
56395643
item = item["body"]
56405644

changelog/0.13.12.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
v0.13.12
2+
3+
## Fixes
4+
5+
- Fixed "Unused variables - variable remains underlined also when it is used in an assignment statement" #18
6+
- Fixed "Evaluate JavaScript - TypeError: 'NoneType' object is not iterable on self.command += kwargs.get("command")" #17
7+
- Not showing the on_hover_description tooltip on a quoted strings or numeric constants, in order to prevent "Go to definition" on them
8+
9+
## Improvements
10+
11+
- Finally published on Package Control ⭐
12+
13+
14+
15+
=================================================================
16+
** THIS PLUGIN IS IN BETA! Thanks for your support in advance! **
17+
=================================================================
18+
19+
If you like it, remember to star it ⭐ on GitHub: https://github.com/pichillilorenzo/JavaScriptEnhancements
20+
21+
** USAGE **
22+
===========
23+
24+
See how it works on the Wiki: 👉👉 https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki 👈👈
25+
26+
27+
** WHAT IS THIS? **
28+
===================
29+
30+
This plugin uses Flow (javascript static type checker from Facebook) under the hood.
31+
32+
It offers better javascript autocomplete and a lot of features about creating,
33+
developing and managing javascript projects, such as:
34+
35+
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
36+
- Ionic v1 and v2 projects (same as Cordova projects!)
37+
- Angular v1 and v2 projects
38+
- React projects (only about the creation at this moment)
39+
- React Native projects (only about the creation at this moment. I will add also NativeScript support)
40+
- Express projects (only about the creation at this moment)
41+
- Yeoman generators
42+
- Local bookmarks project
43+
- JavaScript real-time errors
44+
- etc.
45+
46+
You could use it also in existing projects (see the Wiki - https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Using-it-with-an-existing-project)!
47+
48+
It turns Sublime Text into a JavaScript IDE like!
49+
50+
This project is based on my other Sublime Text plugin JavaScript Completions (https://github.com/pichillilorenzo/JavaScript-Completions)
51+
52+
** NOTE **
53+
If you want use this plugin, you may want uninstall/disable the JavaScript Completions plugin, if installed.
54+
55+
** OS SUPPORTED NOW **
56+
======================
57+
58+
👉 Linux (64-bit)
59+
👉 Mac OS X
60+
👉 Windows (64-bit): released without the use of TerminalView plugin. For each feature (like also creating a project) will be used the cmd.exe shell (so during the creation of a project don't close it until it finishes!). Unfortunately the TerminalView plugin supports only Linux-based OS 😞. Has someone any advice or idea about that? Is there something similar to the TerminalView plugin for Windows?? Thanks!
61+
62+
❗❗ Dependencies ❗❗
63+
=======================
64+
65+
In order to work properly, this plugin has some dependencies:
66+
67+
👉 Sublime Text 3 (build 3124 or newer)
68+
👉 Node.js and npm (https://nodejs.org or nvm (https://github.com/creationix/nvm))
69+
👉 TerminalView (only for Linux and Mac OS X) sublime text plugin (https://github.com/Wramberg/TerminalView)
70+
71+
Not required, but useful for typescript files (Flow wont work on this type of files):
72+
73+
👉 TypeScript sublime text plugin (https://github.com/Microsoft/TypeScript-Sublime-Plugin)
74+
75+
** Flow Requirements **
76+
=======================
77+
78+
It use [Flow](https://github.com/facebook/flow) for type checking and auto-completions.
79+
80+
👉 Mac OS X
81+
👉 Linux (64-bit)
82+
👉 Windows (64-bit)
83+
84+
Email me for any questions or doubts about this new project on: [email protected]
85+
86+
Thanks for your support! 😄😄
87+
88+
MIT License

changelog/install.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ developing and managing javascript projects, such as:
2121
- Cordova projects (run cordova emulate, build, compile, serve, etc. directly from Sublime Text!)
2222
- Ionic v1 and v2 projects (same as Cordova projects!)
2323
- Angular v1 and v2 projects
24-
- React projects
25-
- React Native projects (only about the creation for the moment. I will add also NativeScript support)
26-
- Express projects (only about the creation for the moment)
24+
- React projects (only about the creation at this moment)
25+
- React Native projects (only about the creation at this moment. I will add also NativeScript support)
26+
- Express projects (only about the creation at this moment)
2727
- Yeoman generators
2828
- Local bookmarks project
2929
- JavaScript real-time errors
3030
- etc.
3131

32-
You could use it also in existing projects (see the Wiki - https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki)!
32+
You could use it also in existing projects (see the Wiki - https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Using-it-with-an-existing-project)!
3333

3434
It turns Sublime Text into a JavaScript IDE like!
3535

helper/can_i_use/can_i_use_data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

helper/javascript_completions/on_hover_description_event_listener.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class on_hover_descriptionEventListener(sublime_plugin.EventListener):
4242
def on_hover(self, view, point, hover_zone) :
4343
if not view.match_selector(
4444
point,
45-
'source.js - comment'
45+
'source.js - string - constant - comment'
4646
):
4747
return
4848

@@ -203,6 +203,7 @@ def on_hover_description_async(view, point, hover_zone, popup_position, show_hin
203203

204204
if result[0] and result[1].get("type") and result[1]["type"] != "(unknown)":
205205

206+
print(result[1])
206207
results_found = 1
207208

208209
description = dict()

helper/unused_variables_view_event_listener.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def on_modified_async_with_thread(self, recheck=True):
141141

142142
repetitions[variableName] = [variableRegion]
143143

144-
items = Util.nested_lookup("type", ["MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body)
144+
items = Util.nested_lookup("type", ["VariableDeclarator", "MemberExpression", "CallExpression", "BinaryExpression", "ExpressionStatement", "Property", "ArrayExpression", "ObjectPattern", "AssignmentExpression", "IfStatement", "ForStatement", "WhileStatement", "ForInStatement", "ForOfStatement", "LogicalExpression", "UpdateExpression", "ArrowFunctionExpression", "ConditionalExpression"], body)
145145
for item in items:
146146

147147
if "object" in item :
@@ -192,6 +192,9 @@ def on_modified_async_with_thread(self, recheck=True):
192192
elif "value" in item and isinstance(item["value"],dict) and "name" in item["value"] and item["value"]["type"] == "Identifier":
193193
item = item["value"]
194194

195+
elif "init" in item and isinstance(item["init"],dict) and "name" in item["init"] and item["init"]["type"] == "Identifier":
196+
item = item["init"]
197+
195198
elif "body" in item and isinstance(item["body"],dict) and "name" in item["body"] and item["body"]["type"] == "Identifier":
196199
item = item["body"]
197200

helper/util/main.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,20 @@ def trim_Region(view, region):
295295

296296
@staticmethod
297297
def selection_in_js_scope(view, point = -1, except_for = ""):
298-
selections = view.sel()
298+
try :
299299

300-
if not selections:
301-
return False
300+
sel_begin = view.sel()[0].begin() if point == -1 else point
302301

303-
sel_begin = selections[0].begin() if point == -1 else point
302+
return view.match_selector(
303+
sel_begin,
304+
'source.js ' + except_for
305+
) or view.match_selector(
306+
sel_begin,
307+
'source.js.embedded.html ' + except_for
308+
)
304309

305-
return view.match_selector(
306-
sel_begin,
307-
'source.js ' + except_for
308-
) or view.match_selector(
309-
sel_begin,
310-
'source.js.embedded.html ' + except_for
311-
)
310+
except IndexError as e:
311+
return False
312312

313313
@staticmethod
314314
def replace_with_tab(view, region, pre="", after="", add_to_each_line_before="", add_to_each_line_after="") :

make/_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from shutil import copyfile
44
from threading import Timer
55

6-
PLUGIN_VERSION = "0.13.11"
6+
PLUGIN_VERSION = "0.13.12"
77

88
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
99
PACKAGE_NAME = os.path.basename(PACKAGE_PATH)

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"0.11.11": "changelog/0.11.11.txt",
1212
"0.13.0": "changelog/0.13.0.txt",
1313
"0.13.1": "changelog/0.13.1.txt",
14-
"0.13.11": "changelog/0.13.11.txt"
14+
"0.13.11": "changelog/0.13.11.txt",
15+
"0.13.12": "changelog/0.13.12.txt"
1516
}

0 commit comments

Comments
 (0)