-
Notifications
You must be signed in to change notification settings - Fork 180
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
Wrong highlighting for identifiers with dash #927
Comments
Thanks a lot for the report and the excellent write-up. I can reproduce the issue. We rely on TextMate grammars and semantic highlighting for syntax highlighting. TextMate grammars work on a single file as input and break it up based on lexical rules expressed in regular expressions. Highlighting based on semantic tokens is considered an addition to the TextMate-based syntax highlighting and goes on top of syntax highlighting. As language servers can take a while to load and analyze a project, semantic token highlighting may appear after a short delay. We have improved the refresh of semantic tokens in hashicorp/terraform-ls#630, so we should highlight tokens faster now. And I'll raise a PR to address the bug in the grammar file soon. |
* Add a base snapshot test for issue #927 * Fix syntax highlighting for attribute access with dashes The dash hasn't been a part of the attribute access end capture. Furthermore, we didn't correctly detect splat and indices on attribute access notation. * add comments to attribute access section
We've just merged #933 to address this issue. This change will be released in the preview extension later this day if you would like to try this out. Furthermore, we will be releasing this to stable in the near future. |
Thank you very much! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Server Version
Terraform Version
Client Version
Terraform Configuration Files
foo/all.tf:
test.tf:
Log Output
https://gist.github.com/orgads/ac0993b63aaca5601affd4dd7431e233
Expected Behavior
The identifiers that contain dash should be highlighted as identifiers.
Actual Behavior
They are only highlighted up to the dash, and the rest is white. Also the words "var" and "module" are not highlighted in this case.
After I run terraform init and reopen the file, highlighting is fixed. But if I reload the window, it is broken again until I reopen the file a few times.
In my project, the case is even worse. I can't get it to work, even after terraform init and reopening.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: