├── Comments.tmPreferences
├── Completion Rules.tmPreferences
├── Get-Elements.sublime-snippet
├── Install.py
├── JSON.tmLanguage
├── JavaScript Indent.tmPreferences
├── JavaScript.tmLanguage
├── LICENSE
├── Object-Method.sublime-snippet
├── Object-Value-JS.sublime-snippet
├── Object-key-key-value.sublime-snippet
├── Prototype-(proto).sublime-snippet
├── README.md
├── Symbol List Banned.tmPreferences
├── Symbol List Class.tmPreferences
├── Symbol List Function.tmPreferences
├── Symbol List Instance.tmPreferences
├── Symbol List Prototype.tmPreferences
├── Symbol List Sub 1.tmPreferences
├── Symbol List Sub 2.tmPreferences
├── console_log.sublime-snippet
├── for-()-{}-(faster).sublime-snippet
├── for-()-{}.sublime-snippet
├── function-(fun).sublime-snippet
├── function.sublime-snippet
├── if-___-else.sublime-snippet
├── if.sublime-snippet
├── messages.json
├── messages
└── install.txt
└── setTimeout-function.sublime-snippet
/Comments.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Comments
7 | scope
8 | source.js, source.json
9 | settings
10 |
11 | shellVariables
12 |
13 |
14 | name
15 | TM_COMMENT_START
16 | value
17 | //
18 |
19 |
20 | name
21 | TM_COMMENT_START_2
22 | value
23 | /*
24 |
25 |
26 | name
27 | TM_COMMENT_END_2
28 | value
29 | */
30 |
31 |
32 |
33 | uuid
34 | A67A8BD9-A951-406F-9175-018DD4B52FD1
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Completion Rules.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | scope
6 | source.js
7 | settings
8 |
9 | cancelCompletion
10 | ^\s*(\{?\s*(else|return|do)|(function)\s*[a-zA-Z_0-9]+)$
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Get-Elements.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | get
4 | source.js
5 | Get Elements
6 |
7 |
--------------------------------------------------------------------------------
/Install.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # from __future__ import print_function
3 | import os.path as path
4 | import sublime
5 |
6 | userSettings = None
7 | packageName = "Better JavaScript"
8 |
9 |
10 | def getPackageName():
11 | global packageName
12 | packageDir = path.dirname(path.abspath( __file__ ))
13 | if packageDir[0] != "/":
14 | return
15 | packageName = path.split(packageDir)[1]
16 | # This needs to be run as soon as possible, because if the cwd changes after loading, the results
17 | # may be wrong
18 | getPackageName()
19 |
20 |
21 | def disable_js_package():
22 | disabled = userSettings.get("ignored_packages", [])
23 |
24 | if not "JavaScript" in disabled:
25 | # Find any views currently using the built-in JS syntaxes and set them to use ours
26 | for window in sublime.windows():
27 | for view in window.views():
28 | syntax = path.basename(view.settings().get('syntax'))
29 | if syntax == "JSON.tmLanguage":
30 | view.set_syntax_file(path.join("Packages", packageName, "JSON.tmLanguage"))
31 | if syntax == "JavaScript.tmLanguage":
32 | view.set_syntax_file(path.join("Packages", packageName, "JavaScript.tmLanguage"))
33 |
34 | disabled.append("JavaScript")
35 |
36 | userSettings.set("ignored_packages", disabled)
37 | sublime.save_settings("Preferences.sublime-settings")
38 |
39 |
40 | def plugin_loaded():
41 | global userSettings
42 | userSettings = sublime.load_settings("Preferences.sublime-settings")
43 | disable_js_package()
44 |
45 |
46 | # Since ST < 3 does not provide the plugin_loaded() hook, we need to run manually. However, if we
47 | # run too soon, then the settings loaded will be empty, which can cause problems like all the user
48 | # settings getting erased. This will wait until we believe the user settings have loaded before
49 | # execitomg the disable_js_package method.
50 | def ensureLoaded():
51 | if userSettings.has('ignored_packages'):
52 | disable_js_package()
53 | else:
54 | sublime.set_timeout(ensureLoaded, 1000)
55 |
56 | if int(sublime.version()) < 3000:
57 | userSettings = sublime.load_settings("Preferences.sublime-settings")
58 | ensureLoaded()
--------------------------------------------------------------------------------
/JSON.tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | fileTypes
6 |
7 | json
8 | sublime-settings
9 | sublime-menu
10 | sublime-keymap
11 | sublime-mousemap
12 | sublime-theme
13 | sublime-build
14 | sublime-project
15 | sublime-completions
16 |
17 | foldingStartMarker
18 | (?x: # turn on extended mode
19 | ^ # a line beginning with
20 | \s* # some optional space
21 | [{\[] # the start of an object or array
22 | (?! # but not followed by
23 | .* # whatever
24 | [}\]] # and the close of an object or array
25 | ,? # an optional comma
26 | \s* # some optional space
27 | $ # at the end of the line
28 | )
29 | | # ...or...
30 | [{\[] # the start of an object or array
31 | \s* # some optional space
32 | $ # at the end of the line
33 | )
34 | foldingStopMarker
35 | (?x: # turn on extended mode
36 | ^ # a line beginning with
37 | \s* # some optional space
38 | [}\]] # and the close of an object or array
39 | )
40 | keyEquivalent
41 | ^~J
42 | name
43 | JSON
44 | patterns
45 |
46 |
47 | include
48 | #value
49 |
50 |
51 | repository
52 |
53 | array
54 |
55 | begin
56 | \[
57 | beginCaptures
58 |
59 | 0
60 |
61 | name
62 | punctuation.definition.array.begin.json
63 |
64 |
65 | end
66 | \]
67 | endCaptures
68 |
69 | 0
70 |
71 | name
72 | punctuation.definition.array.end.json
73 |
74 |
75 | name
76 | meta.structure.array.json
77 | patterns
78 |
79 |
80 | include
81 | #value
82 |
83 |
84 | match
85 | ,
86 | name
87 | punctuation.separator.array.json
88 |
89 |
90 | match
91 | [^\s\]]
92 | name
93 | invalid.illegal.expected-array-separator.json
94 |
95 |
96 |
97 | constant
98 |
99 | match
100 | \b(?:true|false|null)\b
101 | name
102 | constant.language.json
103 |
104 | number
105 |
106 | comment
107 | handles integer and decimal numbers
108 | match
109 | (?x: # turn on extended mode
110 | -? # an optional minus
111 | (?:
112 | 0 # a zero
113 | | # ...or...
114 | [1-9] # a 1-9 character
115 | \d* # followed by zero or more digits
116 | )
117 | (?:
118 | (?:
119 | \. # a period
120 | \d+ # followed by one or more digits
121 | )?
122 | (?:
123 | [eE] # an e character
124 | [+-]? # followed by an option +/-
125 | \d+ # followed by one or more digits
126 | )? # make exponent optional
127 | )? # make decimal portion optional
128 | )
129 | name
130 | constant.numeric.json
131 |
132 | object
133 |
134 | begin
135 | \{
136 | beginCaptures
137 |
138 | 0
139 |
140 | name
141 | punctuation.definition.dictionary.begin.json
142 |
143 |
144 | comment
145 | a JSON object
146 | end
147 | \}
148 | endCaptures
149 |
150 | 0
151 |
152 | name
153 | punctuation.definition.dictionary.end.json
154 |
155 |
156 | name
157 | meta.structure.dictionary.json
158 | patterns
159 |
160 |
161 | comment
162 | the JSON object key
163 | include
164 | #string
165 |
166 |
167 | include
168 | #comments
169 |
170 |
171 | begin
172 | :
173 | beginCaptures
174 |
175 | 0
176 |
177 | name
178 | punctuation.separator.dictionary.key-value.json
179 |
180 |
181 | end
182 | (,)|(?=\})
183 | endCaptures
184 |
185 | 1
186 |
187 | name
188 | punctuation.separator.dictionary.pair.json
189 |
190 |
191 | name
192 | meta.structure.dictionary.value.json
193 | patterns
194 |
195 |
196 | comment
197 | the JSON object value
198 | include
199 | #value
200 |
201 |
202 | match
203 | [^\s,]
204 | name
205 | invalid.illegal.expected-dictionary-separator.json
206 |
207 |
208 |
209 |
210 | match
211 | [^\s\}]
212 | name
213 | invalid.illegal.expected-dictionary-separator.json
214 |
215 |
216 |
217 | string
218 |
219 | begin
220 | "
221 | beginCaptures
222 |
223 | 0
224 |
225 | name
226 | punctuation.definition.string.begin.json
227 |
228 |
229 | end
230 | "
231 | endCaptures
232 |
233 | 0
234 |
235 | name
236 | punctuation.definition.string.end.json
237 |
238 |
239 | name
240 | string.quoted.double.json
241 | patterns
242 |
243 |
244 | match
245 | (?x: # turn on extended mode
246 | \\ # a literal backslash
247 | (?: # ...followed by...
248 | ["\\/bfnrt] # one of these characters
249 | | # ...or...
250 | u # a u
251 | [0-9a-fA-F]{4} # and four hex digits
252 | )
253 | )
254 | name
255 | constant.character.escape.json
256 |
257 |
258 | match
259 | \\.
260 | name
261 | invalid.illegal.unrecognized-string-escape.json
262 |
263 |
264 |
265 | value
266 |
267 | comment
268 | the 'value' diagram at http://json.org
269 | patterns
270 |
271 |
272 | include
273 | #constant
274 |
275 |
276 | include
277 | #number
278 |
279 |
280 | include
281 | #string
282 |
283 |
284 | include
285 | #array
286 |
287 |
288 | include
289 | #object
290 |
291 |
292 | include
293 | #comments
294 |
295 |
296 |
297 |
298 | comments
299 |
300 | patterns
301 |
302 |
303 | begin
304 | /\*\*
305 | captures
306 |
307 | 0
308 |
309 | name
310 | punctuation.definition.comment.json
311 |
312 |
313 | end
314 | \*/
315 | name
316 | comment.block.documentation.json
317 |
318 |
319 | begin
320 | /\*
321 | captures
322 |
323 | 0
324 |
325 | name
326 | punctuation.definition.comment.json
327 |
328 |
329 | end
330 | \*/
331 | name
332 | comment.block.json
333 |
334 |
335 | captures
336 |
337 | 1
338 |
339 | name
340 | punctuation.definition.comment.json
341 |
342 |
343 | match
344 | (//).*$\n?
345 | name
346 | comment.line.double-slash.js
347 |
348 |
349 |
350 |
351 | scopeName
352 | source.json
353 | uuid
354 | 0C3868E4-F96B-4E55-B204-1DCB5A20748B
355 |
356 |
357 |
--------------------------------------------------------------------------------
/JavaScript Indent.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | JavaScript Indent
7 | scope
8 | source.js
9 | settings
10 |
11 | decreaseIndentPattern
12 | ^(.*\*/)?\s*\}.*$
13 | increaseIndentPattern
14 | ^.*\{[^}"']*$
15 |
16 | bracketIndentNextLinePattern
17 | (?x)
18 | ^ \s* \b(if|while|else)\b [^;]* $
19 | | ^ \s* \b(for)\b .* $
20 |
21 |
22 |
23 | uuid
24 | BC062860-3346-4D3B-8421-C5543F83D11F
25 |
26 |
27 |
--------------------------------------------------------------------------------
/JavaScript.tmLanguage:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | comment
6 | JavaScript Syntax: version 2.0
7 | fileTypes
8 |
9 | js
10 | htc
11 | jsx
12 |
13 | firstLineMatch
14 | ^#!/usr/bin/env node
15 | foldingStartMarker
16 | ^.*\bfunction\s*(\w+\s*)?\([^\)]*\)(\s*\{[^\}]*)?\s*$
17 | foldingStopMarker
18 | ^\s*\}
19 | keyEquivalent
20 | ^~J
21 | name
22 | JavaScript
23 | patterns
24 |
25 |
26 | comment
27 | node.js shebang
28 | match
29 | ^#!/usr/bin/env node
30 | name
31 | comment.line.js
32 |
33 |
34 | captures
35 |
36 | 1
37 |
38 | name
39 | support.class.js
40 |
41 | 2
42 |
43 | name
44 | support.constant.js
45 |
46 | 3
47 |
48 | name
49 | keyword.operator.js
50 |
51 |
52 | comment
53 | match stuff like: Sound.prototype = { … } when extending an object
54 | match
55 | ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\s*(=)\s*
56 | name
57 | meta.class.js
58 |
59 |
60 | captures
61 |
62 | 1
63 |
64 | name
65 | support.class.js
66 |
67 | 2
68 |
69 | name
70 | support.constant.js
71 |
72 | 3
73 |
74 | name
75 | entity.name.function.js
76 |
77 | 4
78 |
79 | name
80 | keyword.operator.js
81 |
82 | 5
83 |
84 | name
85 | storage.type.function.js
86 |
87 | 6
88 |
89 | name
90 | punctuation.definition.parameters.begin.js
91 |
92 | 7
93 |
94 | name
95 | variable.parameter.function.js
96 |
97 | 8
98 |
99 | name
100 | punctuation.definition.parameters.end.js
101 |
102 |
103 | comment
104 | match stuff like: Sound.prototype.play = function() { … }
105 | match
106 | ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\.([a-zA-Z_?.$][\w?.$]*)\s*(=)\s*(function)?\s*(\()(.*?)(\))
107 | name
108 | meta.function.prototype.js
109 |
110 |
111 | captures
112 |
113 | 1
114 |
115 | name
116 | support.class.js
117 |
118 | 2
119 |
120 | name
121 | support.constant.js
122 |
123 | 3
124 |
125 | name
126 | entity.name.function.js
127 |
128 | 4
129 |
130 | name
131 | keyword.operator.js
132 |
133 |
134 | comment
135 | match stuff like: Sound.prototype.play = myfunc
136 | match
137 | ([a-zA-Z_?.$][\w?.$]*)\.(prototype)\.([a-zA-Z_?.$][\w?.$]*)\s*(=)\s*
138 | name
139 | meta.function.js
140 |
141 |
142 | captures
143 |
144 | 1
145 |
146 | name
147 | support.class.js
148 |
149 | 2
150 |
151 | name
152 | entity.name.function.js
153 |
154 | 3
155 |
156 | name
157 | keyword.operator.js
158 |
159 | 4
160 |
161 | name
162 | storage.type.function.js
163 |
164 | 5
165 |
166 | name
167 | punctuation.definition.parameters.begin.js
168 |
169 | 6
170 |
171 | name
172 | variable.parameter.function.js
173 |
174 | 7
175 |
176 | name
177 | punctuation.definition.parameters.end.js
178 |
179 |
180 | comment
181 | match stuff like: Sound.play = function() { … }
182 | match
183 | ([a-zA-Z_?.$][\w?.$]*)\.([a-zA-Z_?.$][\w?.$]*)\s*(=)\s*(function)\s*(\()(.*?)(\))
184 | name
185 | meta.function.js
186 |
187 |
188 | captures
189 |
190 | 1
191 |
192 | name
193 | entity.name.function.js
194 |
195 | 2
196 |
197 | name
198 | keyword.operator.js
199 |
200 | 3
201 |
202 | name
203 | storage.type.function.js
204 |
205 | 4
206 |
207 | name
208 | punctuation.definition.parameters.begin.js
209 |
210 | 5
211 |
212 | name
213 | variable.parameter.function.js
214 |
215 | 6
216 |
217 | name
218 | punctuation.definition.parameters.end.js
219 |
220 |
221 | comment
222 | match stuff like: play = function() { … }
223 | match
224 | ([a-zA-Z_?$][\w?$]*)\s*(=)\s*(function)\s*(\()(.*?)(\))
225 | name
226 | meta.function.js
227 |
228 |
229 | captures
230 |
231 | 1
232 |
233 | name
234 | storage.type.function.js
235 |
236 | 2
237 |
238 | name
239 | entity.name.function.js
240 |
241 | 3
242 |
243 | name
244 | punctuation.definition.parameters.begin.js
245 |
246 | 4
247 |
248 | name
249 | variable.parameter.function.js
250 |
251 | 5
252 |
253 | name
254 | punctuation.definition.parameters.end.js
255 |
256 |
257 | comment
258 | match regular function like: function myFunc(arg) { … }
259 | match
260 | \b(function)\s*([a-zA-Z_$]\w*)?\s*(\()(.*?)(\))
261 | name
262 | meta.function.js
263 |
264 |
265 | captures
266 |
267 | 1
268 |
269 | name
270 | entity.name.function.js
271 |
272 | 2
273 |
274 | name
275 | storage.type.function.js
276 |
277 | 3
278 |
279 | name
280 | punctuation.definition.parameters.begin.js
281 |
282 | 4
283 |
284 | name
285 | variable.parameter.function.js
286 |
287 | 5
288 |
289 | name
290 | punctuation.definition.parameters.end.js
291 |
292 |
293 | comment
294 | match stuff like: foobar: function() { … }
295 | match
296 | \b([a-zA-Z_?.$][\w?.$]*)\s*:\s*\b(function)?\s*(\()(.*?)(\))
297 | name
298 | meta.function.json.js
299 |
300 |
301 | captures
302 |
303 | 1
304 |
305 | name
306 | string.quoted.single.js
307 |
308 | 10
309 |
310 | name
311 | punctuation.definition.parameters.begin.js
312 |
313 | 11
314 |
315 | name
316 | variable.parameter.function.js
317 |
318 | 12
319 |
320 | name
321 | punctuation.definition.parameters.end.js
322 |
323 | 2
324 |
325 | name
326 | punctuation.definition.string.begin.js
327 |
328 | 3
329 |
330 | name
331 | entity.name.function.js
332 |
333 | 4
334 |
335 | name
336 | punctuation.definition.string.end.js
337 |
338 | 5
339 |
340 | name
341 | string.quoted.double.js
342 |
343 | 6
344 |
345 | name
346 | punctuation.definition.string.begin.js
347 |
348 | 7
349 |
350 | name
351 | entity.name.function.js
352 |
353 | 8
354 |
355 | name
356 | punctuation.definition.string.end.js
357 |
358 | 9
359 |
360 | name
361 | entity.name.function.js
362 |
363 |
364 | comment
365 | Attempt to match "foo": function
366 | match
367 | (?:((')([^']*)('))|((")([^"]*)(")))\s*:\s*\b(function)?\s*(\()([^)]*)(\))
368 |
369 | name
370 | meta.function.json.js
371 |
372 |
373 | captures
374 |
375 | 1
376 |
377 | name
378 | keyword.operator.new.js
379 |
380 | 2
381 |
382 | name
383 | entity.name.type.instance.js
384 |
385 |
386 | match
387 | (new)\s+(\w+(?:\.\w*)?)
388 | name
389 | meta.class.instance.constructor
390 |
391 |
392 | match
393 | \b(console)\b
394 | name
395 | entity.name.type.object.js.firebug
396 |
397 |
398 | match
399 | \.(warn|info|log|error|time|timeEnd|assert)\b
400 | name
401 | support.function.js.firebug
402 |
403 |
404 | match
405 | \b((0(x|X)[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?))\b
406 | name
407 | constant.numeric.js
408 |
409 |
410 | begin
411 | '
412 | beginCaptures
413 |
414 | 0
415 |
416 | name
417 | punctuation.definition.string.begin.js
418 |
419 |
420 | end
421 | '
422 | endCaptures
423 |
424 | 0
425 |
426 | name
427 | punctuation.definition.string.end.js
428 |
429 |
430 | name
431 | string.quoted.single.js
432 | patterns
433 |
434 |
435 | match
436 | \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)
437 | name
438 | constant.character.escape.js
439 |
440 |
441 |
442 |
443 | begin
444 | "
445 | beginCaptures
446 |
447 | 0
448 |
449 | name
450 | punctuation.definition.string.begin.js
451 |
452 |
453 | end
454 | "
455 | endCaptures
456 |
457 | 0
458 |
459 | name
460 | punctuation.definition.string.end.js
461 |
462 |
463 | name
464 | string.quoted.double.js
465 | patterns
466 |
467 |
468 | match
469 | \\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)
470 | name
471 | constant.character.escape.js
472 |
473 |
474 |
475 |
476 | begin
477 | /\*\*(?!/)
478 | captures
479 |
480 | 0
481 |
482 | name
483 | punctuation.definition.comment.js
484 |
485 |
486 | end
487 | \*/
488 | name
489 | comment.block.documentation.js
490 |
491 |
492 | begin
493 | /\*
494 | captures
495 |
496 | 0
497 |
498 | name
499 | punctuation.definition.comment.js
500 |
501 |
502 | end
503 | \*/
504 | name
505 | comment.block.js
506 |
507 |
508 | captures
509 |
510 | 1
511 |
512 | name
513 | punctuation.definition.comment.js
514 |
515 |
516 | match
517 | (//).*$\n?
518 | name
519 | comment.line.double-slash.js
520 |
521 |
522 | captures
523 |
524 | 0
525 |
526 | name
527 | punctuation.definition.comment.html.js
528 |
529 | 2
530 |
531 | name
532 | punctuation.definition.comment.html.js
533 |
534 |
535 | match
536 | (<!--|-->)
537 | name
538 | comment.block.html.js
539 |
540 |
541 | match
542 | \b(boolean|byte|char|class|double|enum|float|function|int|interface|long|short|var|void)\b
543 | name
544 | storage.type.js
545 |
546 |
547 | match
548 | \b(const|export|extends|final|implements|native|private|protected|public|static|synchronized|throws|transient|volatile)\b
549 | name
550 | storage.modifier.js
551 |
552 |
553 | match
554 | \b(break|case|catch|continue|default|do|else|finally|for|goto|if|import|package|return|switch|throw|try|while)\b
555 | name
556 | keyword.control.js
557 |
558 |
559 | match
560 | \b(delete|in|instanceof|new|typeof|with)\b
561 | name
562 | keyword.operator.js
563 |
564 |
565 | match
566 | \btrue\b
567 | name
568 | constant.language.boolean.true.js
569 |
570 |
571 | match
572 | \bfalse\b
573 | name
574 | constant.language.boolean.false.js
575 |
576 |
577 | match
578 | \bnull\b
579 | name
580 | constant.language.null.js
581 |
582 |
583 | match
584 | \b(super|this)\b
585 | name
586 | variable.language.js
587 |
588 |
589 | match
590 | \b(debugger)\b
591 | name
592 | keyword.other.js
593 |
594 |
595 | match
596 | \b(Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)\b
597 | name
598 | support.class.js
599 |
600 |
601 | match
602 | \b(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))\b(?=\()
603 | name
604 | support.function.js
605 |
606 |
607 | match
608 | \b(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)\b(?=\()
609 | name
610 | support.function.dom.js
611 |
612 |
613 | match
614 | (?<=\.)(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))\b
615 | name
616 | support.constant.js
617 |
618 |
619 | match
620 | (?<=\.)(s(hape|ystemId|c(heme|ope|rolling)|ta(ndby|rt)|ize|ummary|pecified|e(ctionRowIndex|lected(Index)?)|rc)|h(space|t(tpEquiv|mlFor)|e(ight|aders)|ref(lang)?)|n(o(Resize|tation(s|Name)|Shade|Href|de(Name|Type|Value)|Wrap)|extSibling|ame)|c(h(ildNodes|Off|ecked|arset)?|ite|o(ntent|o(kie|rds)|de(Base|Type)?|l(s|Span|or)|mpact)|ell(s|Spacing|Padding)|l(ear|assName)|aption)|t(ype|Bodies|itle|Head|ext|a(rget|gName)|Foot)|i(sMap|ndex|d|m(plementation|ages))|o(ptions|wnerDocument|bject)|d(i(sabled|r)|o(c(type|umentElement)|main)|e(clare|f(er|ault(Selected|Checked|Value)))|at(eTime|a))|useMap|p(ublicId|arentNode|r(o(file|mpt)|eviousSibling))|e(n(ctype|tities)|vent|lements)|v(space|ersion|alue(Type)?|Link|Align)|URL|f(irstChild|orm(s)?|ace|rame(Border)?)|width|l(ink(s)?|o(ngDesc|wSrc)|a(stChild|ng|bel))|a(nchors|c(ce(ssKey|pt(Charset)?)|tion)|ttributes|pplets|l(t|ign)|r(chive|eas)|xis|Link|bbr)|r(ow(s|Span|Index)|ules|e(v|ferrer|l|adOnly))|m(ultiple|e(thod|dia)|a(rgin(Height|Width)|xLength))|b(o(dy|rder)|ackground|gColor))\b
621 | name
622 | support.constant.dom.js
623 |
624 |
625 | match
626 | \b(ELEMENT_NODE|ATTRIBUTE_NODE|TEXT_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|INDEX_SIZE_ERR|DOMSTRING_SIZE_ERR|HIERARCHY_REQUEST_ERR|WRONG_DOCUMENT_ERR|INVALID_CHARACTER_ERR|NO_DATA_ALLOWED_ERR|NO_MODIFICATION_ALLOWED_ERR|NOT_FOUND_ERR|NOT_SUPPORTED_ERR|INUSE_ATTRIBUTE_ERR)\b
627 | name
628 | support.constant.dom.js
629 |
630 |
631 | match
632 | \bon(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))\b
633 | name
634 | support.function.event-handler.js
635 |
636 |
637 | match
638 | !|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|(?<!\()/=|%=|\+=|\-=|&=|\^=|\b(in|instanceof|new|delete|typeof|void)\b
639 | name
640 | keyword.operator.js
641 |
642 |
643 | match
644 | \b(Infinity|NaN|undefined)\b
645 | name
646 | constant.language.js
647 |
648 |
649 | begin
650 | (?<=[=(:]|^|return|&&|\|\||!)\s*(/)(?![/*+{}?])
651 | beginCaptures
652 |
653 | 1
654 |
655 | name
656 | punctuation.definition.string.begin.js
657 |
658 |
659 | end
660 | (/)[igm]*
661 | endCaptures
662 |
663 | 1
664 |
665 | name
666 | punctuation.definition.string.end.js
667 |
668 |
669 | name
670 | string.regexp.js
671 | patterns
672 |
673 |
674 | match
675 | \\.
676 | name
677 | constant.character.escape.js
678 |
679 |
680 |
681 |
682 | match
683 | \;
684 | name
685 | punctuation.terminator.statement.js
686 |
687 |
688 | match
689 | ,[ |\t]*
690 | name
691 | meta.delimiter.object.comma.js
692 |
693 |
694 | match
695 | \.
696 | name
697 | meta.delimiter.method.period.js
698 |
699 |
700 | match
701 | \{|\}
702 | name
703 | meta.brace.curly.js
704 |
705 |
706 | match
707 | \(|\)
708 | name
709 | meta.brace.round.js
710 |
711 |
712 | match
713 | \[|\]
714 | name
715 | meta.brace.square.js
716 |
717 |
718 | scopeName
719 | source.js
720 | uuid
721 | 93E017CC-6F27-11D9-90EB-000D93589AF6
722 |
723 |
724 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Original JavaScript package copyright Sublime HQ Pty Ltd.
2 |
3 | ***
4 |
5 | The rest:
6 |
7 | The MIT License (MIT)
8 |
9 | Copyright (c) 2013 Matthew E. Torok
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy of
12 | this software and associated documentation files (the "Software"), to deal in
13 | the Software without restriction, including without limitation the rights to
14 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15 | the Software, and to permit persons to whom the Software is furnished to do so,
16 | subject to the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
24 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
25 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 |
--------------------------------------------------------------------------------
/Object-Method.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | :f
6 | source.js
7 | Object Method
8 |
9 |
--------------------------------------------------------------------------------
/Object-Value-JS.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | :,
4 | source.js
5 | Object Value JS
6 |
7 |
--------------------------------------------------------------------------------
/Object-key-key-value.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | :
4 | source.js
5 | Object key — key: "value"
6 |
7 |
--------------------------------------------------------------------------------
/Prototype-(proto).sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
6 | proto
7 | source.js
8 | Prototype
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Sublime Better Javascript
2 | =========================
3 |
4 | This package is an improved version of Sublime Text's JavaScript package, focused mainly on improving symbol navigation.
5 |
6 | The default JavaScript language definition in Sublime Text has *quirky* symbol identification, and fills your symbols list with noise like anonymous functions, object instantiation, and even calls to console.log().
7 |
8 | 
9 |
10 | This project fixes Sublime so only named function definitions and function prototype attributes show up in the symbol list. It also fixes how these symbols are displayed in the symbol list, so that only the function names are shown.
11 |
12 | 
13 |
14 | This package has been tested on Sublime Text 2 and 3.
15 |
16 |
17 | Installing
18 | --------------
19 |
20 | Install via [package control](http://wbond.net/sublime_packages/package_control) (search for 'Better JavaScript').
21 |
22 | Alternatively, `cd` to you Sublime packages directory, then:
23 |
24 | git clone git@github.com:int3h/sublime-better-javascript.git 'Sublime Better JavaScript'
25 |
26 |
27 | ### Refreshing the symbols of existing files
28 |
29 | In some cases, especially with Sublime Text 3, the symbols list of files that have been previously opened may not refresh with the improved symbols.
30 |
31 | The most reliable way I've found to fix this is to close all open JavaScript files and quit Sublime (it's important that all JS files are closed when Sublime exits.) Then delete the `Index` and `Cache` subdirectories in your Sublime user data directory (the parent of the `Packages` directory.) In Mac OS X, I've also had to delete ~/Library/Caches/com.sublimetext.3 (or com.sublimetext.2).
32 |
33 |
34 | Uninstalling
35 | ------------
36 | Before uninstalling Better JavaScript, be sure close all open JavaScript/JSON
37 | files, and remove "JavaScript" from the "ignored_packages" list in your Sublime
38 | user settings. You can now safely uninstall the Better JavaScript package.
39 |
40 | It's normal to see a few errors from Sublime about not being able to find syntax files. Just exit
41 | Sublime and re-open it, and everything should be fixed.
42 |
43 |
44 | Details
45 | -------
46 |
47 | The default JavaScript.tmLanguage makes some... odd decisions on what namespace to put certain tokens in. Specifically, it puts a lot of tokens in the entity.name.* namespaces that probably shouldn't be.
48 |
49 | There is a file, `Symbol List Banned.tmPreferences`, in the JavaScript package which ostensibly is supposed to filter out some specific sub-namespaces from the symbols list, but it doesn't really work. I modified `Symbol List Banned.tmPreferences` to specifically match object instantiation and console.log calls, and set them to not show up in the symbol list.
50 |
51 | I also modified `Symbol List Function.tmPreferences` to do additional processing of function names with regexes, to strip out extraneous characters (like "function" and "= function()") before showing them in the symbol list. An additional file, `Symbol List Prototype.tmPreferences`, was added to include function prototype attributes in the symbol list.
52 |
--------------------------------------------------------------------------------
/Symbol List Banned.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Banned
7 | scope
8 | source.js meta.property.function entity.name.function, entity.name.type.instance.js, entity.name.type.object.js.firebug
9 | settings
10 |
11 | showInSymbolList
12 | 0
13 | showInIndexedSymbolList
14 | 1
15 |
16 | uuid
17 | 834BC727-6B31-4073-A161-4823227219EG
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Symbol List Class.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Class
7 | scope
8 | source.js entity.name.type.class
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 |
15 | s/^/• /g;
16 |
17 |
18 | uuid
19 | 3CEA49B2-A5C5-405C-82E2-B8B668877C37
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Symbol List Function.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Function
7 | scope
8 | source.js meta.function.js, source.js meta.function.json.js
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 | s/^function\s*\(.*\)//g; s/function\s+([a-zA-Z_?.$][\w?.$]*)\s*\(.*\)/\1/g; s/([a-zA-Z_?.$][\w?.$]*)\s*=.*/\1/g
15 |
16 | uuid
17 | C6215136-0E84-45D0-9670-4F58028648B9
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Symbol List Instance.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Instance
7 | scope
8 | source.js entity.name.instance
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 |
15 | s/^/\t/g;
16 |
17 |
18 | uuid
19 | E6EB7CC8-04E8-43A9-93B2-BC9EF5BA862B
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Symbol List Prototype.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Function
7 | scope
8 | meta.function.prototype.js
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 | s/([a-zA-Z_?.$][\w?.$]*)\s*=.*/\1/g
15 |
16 | uuid
17 | 37FCDC90-EE7C-11E2-91E2-0800200C9A66
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Symbol List Sub 1.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Sub 1
7 | scope
8 | source.js object.property.function -(meta.group meta.group)
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 |
15 | s/^/ :/g;
16 |
17 |
18 | uuid
19 | 73557394-4F0F-4DD3-8029-EEE8201AC7F5
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Symbol List Sub 2.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List Sub 2
7 | scope
8 | source.js meta.group meta.group object.property.function
9 | settings
10 |
11 | showInSymbolList
12 | 1
13 | symbolTransformation
14 |
15 | s/^/ :/g;
16 |
17 |
18 | uuid
19 | 51841DDB-C2A4-461C-A8AB-6C124AD50EAE
20 |
21 |
22 |
--------------------------------------------------------------------------------
/console_log.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
4 | log
5 | source.js
6 | console.log(...);
7 |
8 |
--------------------------------------------------------------------------------
/for-()-{}-(faster).sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 | = 0; ${20:i}--) {
3 | ${100:${1:Things}[${20:i}]}$0
4 | };]]>
5 | for
6 | source.js
7 | for (…) {…} (Improved Native For-Loop)
8 |
9 |
--------------------------------------------------------------------------------
/for-()-{}.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | for
6 | source.js
7 | for (…) {…}
8 |
9 |
--------------------------------------------------------------------------------
/function-(fun).sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
5 | fun
6 | source.js
7 | Function
8 |
9 |
--------------------------------------------------------------------------------
/function.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | f
4 | source.js
5 | Anonymous Function
6 |
7 |
--------------------------------------------------------------------------------
/if-___-else.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | ife
4 | source.js
5 | if … else
6 |
7 |
--------------------------------------------------------------------------------
/if.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | if
4 | source.js
5 | if
6 |
7 |
--------------------------------------------------------------------------------
/messages.json:
--------------------------------------------------------------------------------
1 | {
2 | "install": "messages/install.txt"
3 | }
--------------------------------------------------------------------------------
/messages/install.txt:
--------------------------------------------------------------------------------
1 | Better JavaScript is now installed! To ensure that the updated syntax file and symbol list take
2 | effect, you may need to do the following:
3 |
4 | 1. Close all open JavaScript/JSON files (including .sublime-settings files)
5 | 2. Exit Sublime
6 | 3. Delete the cache and index files in your Sublime user directory
7 | 4. Re-open Sublime
8 |
9 |
10 | Uninstalling
11 | ------------
12 | Before uninstalling Better JavaScript, be sure close all open JavaScript/JSON
13 | files, and remove "JavaScript" from the "ignored_packages" list in your Sublime
14 | user settings. You can now safely uninstall the Better JavaScript package.
15 |
16 | It's normal to see a few errors from Sublime about not being able to find syntax files. Just exit
17 | Sublime and re-open it, and everything should be fixed.
--------------------------------------------------------------------------------
/setTimeout-function.sublime-snippet:
--------------------------------------------------------------------------------
1 |
2 |
3 | timeout
4 | source.js
5 | setTimeout function
6 |
7 |
--------------------------------------------------------------------------------