Skip to content

Commit

Permalink
[JavaScript] Fix scoping of called private method names. (sublimehq#2487
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Thom1729 authored and mitranim committed Mar 20, 2022
1 parent cb18379 commit dd83d1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions JavaScript/JavaScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ contexts:
- function-call-arguments
- literal-variable

- match: (?={{identifier}}\s*(?:{{dot_accessor}}\s*{{identifier}}\s*)+(?:{{dot_accessor}})?\()
- match: (?={{identifier}}\s*(?:{{dot_accessor}}\s*#?{{identifier}}\s*)+(?:{{dot_accessor}})?\()
set:
- call-method-meta
- function-call-arguments
Expand Down Expand Up @@ -1946,6 +1946,11 @@ contexts:
- match: '{{identifier}}'
scope: variable.function.js
pop: true
- match: '(#){{identifier}}'
scope: variable.function.js
captures:
1: punctuation.definition.js
pop: true
- include: else-pop

literal-variable:
Expand Down Expand Up @@ -2372,7 +2377,7 @@ contexts:
object-property:
- match: |-
(?x)(?=
{{identifier}}
\#?{{identifier}}
\s* = \s*
{{either_func_lookahead}}
)
Expand All @@ -2383,7 +2388,7 @@ contexts:
- include: support-property

- match: '(?={{identifier}}\s*(?:{{dot_accessor}})?\()'
- match: '(?=#?{{identifier}}\s*(?:{{dot_accessor}})?\()'
set: call-method-name

- include: object-property-base
Expand Down
6 changes: 6 additions & 0 deletions JavaScript/tests/syntax_test_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,12 @@ sources.DOM
.status()
// ^ meta.function-call.method variable.function

foo.#bar();
// ^^^^^^^^^^ meta.function-call.method.js
// ^^^^ variable.function.js
// ^ punctuation.definition.js
// ^^ meta.group.js

return new Promise(resolve => preferenceObject.set({value}, resolve));
// ^ meta.function-call.constructor punctuation.section.group.end

Expand Down

0 comments on commit dd83d1b

Please sign in to comment.