-
Notifications
You must be signed in to change notification settings - Fork 238
Conversation
This commit fixes a minor bug with scope-matching: window.innerWidth # Ends in support.constant.js window. innerWidth # Doesn't Both lines are nonetheless identical in JavaScript.
* Added the full list of standardised web APIs from MDN: https://developer.mozilla.org/en-US/docs/Web/API * Added support for less heard-of ES6+ value types (ArrayBuffer, SIMD …) * Added "dom" scope for DOM-specific interfaces and objects * Removed highlighting for non-standard/deprecated properties/classes
* Fixes inconsistent scopes with full-stops (closes #280) * Fixes "new obj.ct.Class();" stopping at "new obj.ct" * Fixes "new obj.ct.Cla$$();" not matching due to dollar signs
Also, there is a conflict with #408 |
Okay, done. @MaximSokolov, if you need to make any further changes, remember to rebase against my branch. |
@@ -705,13 +705,19 @@ | |||
'name': 'meta.class.js' | |||
} | |||
{ | |||
'match': '(new)\\s+([\\w$]+[\\w.$]*)' | |||
'name': 'meta.class.instance.constructor' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a .js
to the end of this?
Please keep the specs formatting in line with the existing ones. |
I'm guessing you're referring to the columnar-layout of the "Unicode escape sequences" block, right? Fixed. |
expect(tokens[2]).toEqual value: '$something', scopes: ['source.js', 'meta.class.instance.constructor.js', 'entity.name.type.instance.js'] | ||
|
||
{tokens} = grammar.tokenizeLine('var instance = new obj.ct.Cla$s();') | ||
expect(tokens).toEqual [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also talking about these specs
@@ -1138,6 +1220,12 @@ describe "Javascript grammar", -> | |||
{tokens} = grammar.tokenizeLine('this.obj.prototype = new El()') | |||
expect(tokens[0]).toEqual value: 'this', scopes: ['source.js', 'variable.language.js'] | |||
|
|||
{tokens} = grammar.tokenizeLine('$this') | |||
expect(tokens[0].value).toEqual '$this' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@50Wliu Can you explain to me exactly what it is you want me to do? I'm really not following here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep them in expect(tokens[x]).toEqual value: 'value', scopes: ['scopes']
form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I guess you don't really have to change this one, but definitely the one on L159.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
There's quite a bit happening with this PR, so hopefully my explanations are digestible.
Added: Support for ES6 Unicode escapes

## Fixed: Bugs with constructorsConstructors containing dollar-signs or multiple constructors weren't matched the same way as those who didn't (also fixes #280):

## Fixed: Issues with dollar-signsFixes #409: Wrong highlighting for constants with dollar sign:
Also fixed an issue I picked up with constants not matching if they begin with an underscore:
Also fixes #344: Wrong scope on
$this
and$default
:Fixed: "Support constants" only recognised without space
Minor fix:
Fixed: Missing highlighting for ES6+ classes
Added highlighting for modern JavaScript classes added in recent versions of the language:
Added: Better DOM support
I wrote a script to generate a regex block from the web interfaces documented on MDN. Note I purposefully omitted any APIs that're deprecated, non-standard, or still considered "experimental".
At the same time, I've also removed support for these keywords, which refer to Netscape-era technologies that've been deprecated since forever:
The latter list has been superseded by standardised HTML* classes. For example:
Anchor
->HTMLAnchor
Area
->HTMLArea
Select
->HTMLSelect