Skip to content

Commit 177f512

Browse files
adding 'keyword.operator.accessor.js' for JavaScript (Babel) support
1 parent 203bf21 commit 177f512

File tree

5 files changed

+99
-11
lines changed

5 files changed

+99
-11
lines changed

_generated_2018_01_03_at_13_27_16.py renamed to _generated_2018_01_03_at_14_55_38.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,7 +3055,7 @@ def run_auto_complete(self):
30553055

30563056
def on_query_completions(self, view, prefix, locations):
30573057
# Return the pending completions and clear them
3058-
#
3058+
30593059
if not view.match_selector(
30603060
locations[0],
30613061
'source.js - string - comment'
@@ -3066,7 +3066,8 @@ def on_query_completions(self, view, prefix, locations):
30663066

30673067
scope = view.scope_name(view.sel()[0].begin()-1).strip()
30683068

3069-
if not prefix and not scope.endswith(" punctuation.accessor.js") :
3069+
# added "keyword.operator.accessor.js" for JavaScript (Babel) support
3070+
if not prefix and not (scope.endswith(" punctuation.accessor.js") or scope.endswith(" keyword.operator.accessor.js")) :
30703071
sublime.active_window().active_view().run_command(
30713072
'hide_auto_complete'
30723073
)
@@ -3202,7 +3203,7 @@ def on_text_command(self, view, command_name, args):
32023203

32033204
if command_name == "left_delete" :
32043205
scope = view.scope_name(view.sel()[0].begin()-1).strip()
3205-
if scope.endswith(" punctuation.accessor.js") :
3206+
if scope.endswith(" punctuation.accessor.js") or scope.endswith(" keyword.operator.accessor.js"):
32063207
sublime.active_window().active_view().run_command(
32073208
'hide_auto_complete'
32083209
)
@@ -3223,7 +3224,7 @@ def on_selection_modified_async(self, view) :
32233224
scope1 = view.scope_name(selections[0].begin()-1).strip()
32243225
scope2 = view.scope_name(selections[0].begin()-2).strip()
32253226

3226-
if scope1.endswith(" punctuation.accessor.js") and not scope2.endswith(" punctuation.accessor.js") and view.substr(selections[0].begin()-2).strip() :
3227+
if (scope1.endswith(" punctuation.accessor.js") or scope1.endswith(" keyword.operator.accessor.js")) and not (scope2.endswith(" punctuation.accessor.js") or scope2.endswith(" keyword.operator.accessor.js")) and view.substr(selections[0].begin()-2).strip() :
32273228

32283229
locations = list()
32293230
locations.append(selections[0].begin())
@@ -4010,7 +4011,10 @@ def on_hover(self, point, hover_zone) :
40104011

40114012
row_region, col_region = view.rowcol(region_hover_error.begin())
40124013
row_region, endcol_region = view.rowcol(region_hover_error.end())
4013-
4014+
# print(view.substr(region_hover_error).split("\n"))
4015+
# print(self.description_by_row_column)
4016+
# print(str(row_region)+":"+str(col_region)+":"+str(endcol_region))
4017+
# return
40144018
error = self.description_by_row_column[str(row_region)+":"+str(col_region)+":"+str(endcol_region)]
40154019

40164020
if error:

changelog/0.1.13.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
v0.1.13
2+
3+
## Fixes
4+
5+
- added "keyword.operator.accessor.js" for JavaScript (Babel) support, 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: pichillilorenzo@gmail.com
76+
77+
Thanks for your support! 😄😄
78+
79+
MIT License

helper/javascript_completions/on_query_completions_event_listener.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def run_auto_complete(self):
5858

5959
def on_query_completions(self, view, prefix, locations):
6060
# Return the pending completions and clear them
61-
#
61+
6262
if not view.match_selector(
6363
locations[0],
6464
'source.js - string - comment'
@@ -69,7 +69,8 @@ def on_query_completions(self, view, prefix, locations):
6969

7070
scope = view.scope_name(view.sel()[0].begin()-1).strip()
7171

72-
if not prefix and not scope.endswith(" punctuation.accessor.js") :
72+
# added "keyword.operator.accessor.js" for JavaScript (Babel) support
73+
if not prefix and not (scope.endswith(" punctuation.accessor.js") or scope.endswith(" keyword.operator.accessor.js")) :
7374
sublime.active_window().active_view().run_command(
7475
'hide_auto_complete'
7576
)
@@ -205,7 +206,7 @@ def on_text_command(self, view, command_name, args):
205206

206207
if command_name == "left_delete" :
207208
scope = view.scope_name(view.sel()[0].begin()-1).strip()
208-
if scope.endswith(" punctuation.accessor.js") :
209+
if scope.endswith(" punctuation.accessor.js") or scope.endswith(" keyword.operator.accessor.js"):
209210
sublime.active_window().active_view().run_command(
210211
'hide_auto_complete'
211212
)
@@ -226,7 +227,7 @@ def on_selection_modified_async(self, view) :
226227
scope1 = view.scope_name(selections[0].begin()-1).strip()
227228
scope2 = view.scope_name(selections[0].begin()-2).strip()
228229

229-
if scope1.endswith(" punctuation.accessor.js") and not scope2.endswith(" punctuation.accessor.js") and view.substr(selections[0].begin()-2).strip() :
230+
if (scope1.endswith(" punctuation.accessor.js") or scope1.endswith(" keyword.operator.accessor.js")) and not (scope2.endswith(" punctuation.accessor.js") or scope2.endswith(" keyword.operator.accessor.js")) and view.substr(selections[0].begin()-2).strip() :
230231

231232
locations = list()
232233
locations.append(selections[0].begin())

helper/javascript_completions/show_flow_errors_view_event_listener.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ def on_hover(self, point, hover_zone) :
157157

158158
row_region, col_region = view.rowcol(region_hover_error.begin())
159159
row_region, endcol_region = view.rowcol(region_hover_error.end())
160-
160+
# print(view.substr(region_hover_error).split("\n"))
161+
# print(self.description_by_row_column)
162+
# print(str(row_region)+":"+str(col_region)+":"+str(endcol_region))
163+
# return
161164
error = self.description_by_row_column[str(row_region)+":"+str(col_region)+":"+str(endcol_region)]
162165

163166
if error:

messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"0.1.01": "changelog/0.1.01.txt",
55
"0.1.10": "changelog/0.1.10.txt",
66
"0.1.11": "changelog/0.1.11.txt",
7-
"0.1.12": "changelog/0.1.12.txt"
7+
"0.1.12": "changelog/0.1.12.txt",
8+
"0.1.13": "changelog/0.1.13.txt"
89
}

0 commit comments

Comments
 (0)