Skip to content

Conversation

@alexlafroscia
Copy link
Contributor

@alexlafroscia alexlafroscia commented Apr 7, 2021

I work in a codebase that uses decorators quite a bit (Ember.js) and noticed that a decorator applied to a property didn't seem to work. The highlighting looks okay if there's not initializer, but if the property is initialized, you get something like this:

Screenshot of parsing error

CleanShot 2021-04-07 at 16 25 47@2x

After checking out the grammar, it seems like decorators on properties weren't really supported at all!

Now it should parse (and highlight) them correctly.

Screenshot of fixed parser

CleanShot 2021-04-07 at 16 37 17@2x

@alexlafroscia alexlafroscia force-pushed the fix-property-decorator-with-initializer branch from 9191564 to 81ba26f Compare April 7, 2021 20:28
@alexlafroscia
Copy link
Contributor Author

I also noticed that the src/parser.c file has diffs if you run tree-sitter generate on the master commit. Maybe someone slipped in a code change without re-generating it?

I have a GitHub Action set up to prevent this in a grammar that I maintain

https://github.com/alexlafroscia/tree-sitter-glimmer/blob/ca8d1533c91107039e7a3f84019378eefe357582/.github/workflows/verify.yml#L26-L51

If you're interested, I'd be happy to add something similar to the workflows for this repo so that that kind of problem is avoided here, too!

@alexlafroscia alexlafroscia force-pushed the fix-property-decorator-with-initializer branch from 81ba26f to 800061e Compare April 7, 2021 20:34
@alexlafroscia
Copy link
Contributor Author

I went and rebased this PR so that it separates out the parser diff from master and the actual changes I'm trying to make.

@alexlafroscia
Copy link
Contributor Author

alexlafroscia commented Apr 7, 2021

It seems like the GitHub Actions configuration is maybe broken? CI didn't run at all here...

Edit: Fixed by #167

@maxbrunsfeld maxbrunsfeld merged commit 4a95461 into tree-sitter:master Apr 7, 2021
@maxbrunsfeld
Copy link
Contributor

Thanks!

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.

2 participants