Skip to content

Commit

Permalink
Scope length method correctly
Browse files Browse the repository at this point in the history
Fixes #730
  • Loading branch information
sheetalkamat committed Mar 19, 2019
1 parent 95f5929 commit cce0e00
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1805,9 +1805,9 @@ repository:
# DOM
- match: |-
(?x) {{propertyAccess}} \s* (?:
(constructor|length|prototype|__proto__)
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*{{typeParameters}}?\())
|
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))
captures:
'1': { name: punctuation.accessor.ts }
'2': { name: punctuation.accessor.optional.ts }
Expand Down
4 changes: 2 additions & 2 deletions TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -5843,9 +5843,9 @@
<dict>
<key>match</key>
<string>(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
(constructor|length|prototype|__proto__)
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?\())
|
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)</string>
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))</string>
<key>captures</key>
<dict>
<key>1</key>
Expand Down
4 changes: 2 additions & 2 deletions TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -5765,9 +5765,9 @@
<dict>
<key>match</key>
<string>(?x) (?:(\.)|(\?\.(?!\s*[[:digit:]]))) \s* (?:
(constructor|length|prototype|__proto__)
(?:(constructor|length|prototype|__proto__)\b(?!\$|\s*(&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;]|\&lt;\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=&lt;&gt;]|=[^&lt;])*\&gt;)*&gt;\s*)?\())
|
(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY))\b(?!\$)</string>
(?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\b(?!\$)))</string>
<key>captures</key>
<dict>
<key>1</key>
Expand Down
24 changes: 24 additions & 0 deletions tests/baselines/Issue730.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
original file
-----------------------------------
object.length('it should be function type')
-----------------------------------

Grammar: TypeScript.tmLanguage
-----------------------------------
>object.length('it should be function type')
^^^^^^
source.ts meta.function-call.ts variable.other.object.ts
^
source.ts meta.function-call.ts punctuation.accessor.ts
^^^^^^
source.ts meta.function-call.ts entity.name.function.ts
^
source.ts meta.brace.round.ts
^
source.ts string.quoted.single.ts punctuation.definition.string.begin.ts
^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts string.quoted.single.ts
^
source.ts string.quoted.single.ts punctuation.definition.string.end.ts
^
source.ts meta.brace.round.ts
1 change: 1 addition & 0 deletions tests/cases/Issue730.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
object.length('it should be function type')

0 comments on commit cce0e00

Please sign in to comment.