-
Notifications
You must be signed in to change notification settings - Fork 237
Fix #460: Incorrect highlighting for multiline imports #463
Conversation
|
/cc @MaximSokolov |
grammars/javascript.cson
Outdated
| } | ||
| { | ||
| 'match': '\\b([a-zA-Z_$][\\w$]*)\\b(?=.*\\bfrom\\b)' | ||
| 'match': '\\b([a-zA-Z_$][\\w$]*)\\b(?=.*(?:$|\\bfrom\\b))' |
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.
(?=.*(?:$|\\bfrom\\b)) is not needed here
spec/javascript-spec.coffee
Outdated
|
|
||
| lines = grammar.tokenizeLines """ | ||
| import | ||
| \\x20{2} |
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.
It should be \x20\x20. I don't think testing for whitespaces is necessary, as it's already separated by lines
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.
The whitespace is only to stop the whitespace package stripping empty lines or something, which is what @50Wliu pointed out in another pull request.
The blank lines are also to ensure multiline-matching isn't restricted to the following line only.
Not sure how I managed to get the \x20{2} part wrong either... guess I must've been thinking in regex-mode, heh.
spec/javascript-spec.coffee
Outdated
|
|
||
| lines = grammar.tokenizeLines """ | ||
| import | ||
| \\t |
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.
Same 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.
Also \\t -> \t
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 clearly can't edit a language grammar while compiling a V8 build, it seems. )))))))))))
Pushed an amended commit.
spec/javascript-spec.coffee
Outdated
|
|
||
| lines = grammar.tokenizeLines """ | ||
| import | ||
| \\x20 |
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.
It's should be \x20 not \\x20. You can add test for lines[1][0] to make sure
spec/javascript-spec.coffee
Outdated
|
|
||
| lines = grammar.tokenizeLines """ | ||
| import | ||
| \\x20{2} |
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.
Also here
spec/javascript-spec.coffee
Outdated
| } | ||
| \\t | ||
| from | ||
| \\t |
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 here
CSON-based grammars are poisonous to the mind and must die.
Fixes the issues brought up by @bgriffith in #460, as well as another I noticed while filling out specs: