Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Change scopes in comparison to language-babel #628

Merged
merged 1 commit into from
Nov 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions grammars/tree-sitter-javascript.cson
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ scopes:
'variable.other.object.property'
]

'member_expression > property_identifier': 'variable.other.object.property.unquoted'

'formal_parameters > identifier': 'formal-parameter.identifier'

'shorthand_property_identifier': [
{
match: '^[\$A-Z_]{2,}$',
Expand All @@ -83,14 +87,15 @@ scopes:
jsx_opening_element > identifier,
jsx_closing_element > identifier,
jsx_self_closing_element > identifier,
call_expression > identifier
': [
{
match: '^[A-Z]',
scopes: 'meta.class'
},
scopes: 'meta.class.component.jsx'
}
]

'call_expression > identifier': {match: '^[A-Z]', scopes: 'meta.class'}

'function > identifier': 'entity.name.function'
'generator_function > identifier': 'entity.name.function'

Expand All @@ -106,9 +111,13 @@ scopes:

'identifier': [
{
match: '^(global|module|exports|__filename|__dirname|window|document)$',
match: '^(global|module|exports|__filename|__dirname)$',
scopes: 'support.variable'
},
{
match: '^(window|event|document|performance|screen|navigator|console)$'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should performance be marked as this scope? As far as I know it's not part of the DOM, but I could quite easily be mistaken here.

console and navigator could also potentially be left out of here, but as they are accessible under the window object I can see leaving them here.

I'd suggest leaving performance as support.variable, but as the TextMate grammar currently marks it as support.variable.dom and it does call the main timestamp a DOMHighResTimeStamp I can definitely see leaving it there.

I just wanted to bring it up in case we were inheriting a bug from TextMate 😉, feel free to leave it there!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe performance was previously grouped with window and document because it is a browser API (as opposed to something that's available in node and other non-web environments).

I don't have strong opinions either way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with this. We can come back and tweak it further later.

scopes: 'support.variable.dom'
},
{
exact: 'require',
scopes: 'support.function'
Expand Down Expand Up @@ -199,7 +208,7 @@ scopes:
'"|"': 'keyword.operator.js'
'"++"': 'keyword.operator.js'
'"--"': 'keyword.operator.js'
'"..."': 'keyword.operator.js'
'"..."': 'keyword.operator.spread.js'

'"in"': 'keyword.operator.in'
'"instanceof"': 'keyword.operator.instanceof'
Expand Down