Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JavaScript] Improve arrow function fallback behavior #1744

Conversation

Thom1729
Copy link
Collaborator

See babel/babel-sublime#348 (comment).

Example:

({
    a = {},
//    ^ keyword.operator.assignment
//      ^^ punctuation.section.block
//        ^ punctuation.separator.comma - keyword.operator.comma
    b,
//   ^ punctuation.separator.comma - keyword.operator.comma
}) => null;
// ^^ storage.type.function.arrow

The arrow function parameter list will be misparsed as a parenthesized expression and the destructured parameters as an object literal. (See sublimehq/sublime_text#2241.) To accommodate this, we handle = signs inside object literals to provide the best possible fallback behavior. Without this, some parameter default values can break highlighting for the rest of the object literal.

@wbond wbond merged commit 7142f81 into sublimehq:master Nov 27, 2018
@Thom1729 Thom1729 deleted the javascript-destructured-object-arrow-parameter-fallback branch November 27, 2018 23:34
deathaxe pushed a commit to deathaxe/sublime-packages that referenced this pull request Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants