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

Incorrect semantic highlighting for block braces #387

Closed
pjmiravalle opened this issue Feb 2, 2021 · 3 comments · Fixed by #390
Closed

Incorrect semantic highlighting for block braces #387

pjmiravalle opened this issue Feb 2, 2021 · 3 comments · Fixed by #390
Assignees
Labels
bug Something isn't working textDocument/semanticTokens Semantic syntax highlighting

Comments

@pjmiravalle
Copy link

When editor.semanticHighlighting.enabled is set to true in vscode, it causes an issue with syntax highlighting for resource/data block declarations.

Specifically, the curly brace bracket(s) after resource "type" "name" is wrapped in the same syntax highlighting token that is used for "type" "name", which causes the bracket to take on the wrong color in the editor. Hopefully that makes sense.

My guess is that the recent additions of this extension dipping its toes into using semantic tokens (#523) is causing this to occur.

editor.semanticHighlighting.enabled ENABLED

Screen Shot 2021-02-02 at 11 23 33 AM

This also seems to happen for data resource declarations:
Screen Shot 2021-02-02 at 11 22 07 AM

editor.semanticHighlighting.enabled DISABLED

Screen Shot 2021-02-02 at 11 24 36 AM

@pjmiravalle pjmiravalle changed the title Syntax Highlighting for resource block broken with "editor.semanticHighlighting.enabled" set to true Syntax Highlighting for resource/data block broken with "editor.semanticHighlighting.enabled" set to true Feb 2, 2021
@radeksimko radeksimko self-assigned this Feb 2, 2021
@radeksimko
Copy link
Member

Thank you for the detailed report, I managed to reproduce this with the following minimal config:

resource "aws_iam_role_policy" "firehose_s3_access" {

}

Given that this highlighting is provided by the language server it's also likely where it can be fixed, so I'm going to transfer the issue there.

@radeksimko radeksimko transferred this issue from hashicorp/vscode-terraform Feb 2, 2021
@radeksimko radeksimko changed the title Syntax Highlighting for resource/data block broken with "editor.semanticHighlighting.enabled" set to true Incorrect semantic highlighting for block braces Feb 2, 2021
@radeksimko radeksimko added bug Something isn't working textDocument/semanticTokens Semantic syntax highlighting labels Feb 2, 2021
@radeksimko
Copy link
Member

I just raised a PR with fix #390, which once reviewed and merged will be part of the next LS release. VS Code in particular should then download and install the new version of LS automatically on launch and fix the problem there.

@ghost
Copy link

ghost commented Mar 5, 2021

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working textDocument/semanticTokens Semantic syntax highlighting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants