Skip to content

Conversation

@ccarpita
Copy link
Contributor

Arrow expressions with "naked" single parameters are currently not being
recognized as such, due to the mis-labeling of the expression as assignment.

// The part: `x =` looks like assignment to syntax rules:
let myFunc = x => 3;

This change introduces a negative lookahead for the > character in
the assignment matcher.

Issue: GH-272

Arrow expressions with "naked" single parameters are currently not being
recognized as such, due to the mis-labeling of the expression as assignment.

```js
// The part: `x =` looks like assignment to syntax rules:
let myFunc = x => 3;
```

This change introduces a negative lookahead for the `>` character in
the assignment matcher.
@qstrahl
Copy link
Collaborator

qstrahl commented Jul 17, 2015

Slightly nervous about the lookahead, but let's try it and see if anyone reports bad behaviour / slowness

qstrahl added a commit that referenced this pull request Jul 17, 2015
fix: Highlight arrow functions with bare single params
@qstrahl qstrahl merged commit 709fd61 into pangloss:develop Jul 17, 2015
@davidchambers
Copy link
Collaborator

Thanks, @ccarpita!

@ccarpita
Copy link
Contributor Author

Good point about the lookahead, though it's single char and should evaluate quickly for assignment expressions. If the performance suffers we should probably create a region type for the full arrow expressions with prioritized matching over assignment

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