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

(TFECO-7531) fix(hcl): don't parse expressions containing an open curly brace as blocks #149

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

ansgarm
Copy link
Member

@ansgarm ansgarm commented Sep 17, 2024

This fixes the following problem in Terraform Test files (which use the HCL syntax instead of the more specialized Terraform one):
image
The grammar treats the opening brace that is part of the template string as a block and therefore breaks the following lines (mostly treated as a string).

This PR restricts parsing blocks as it only allows block labels to contain any character if that label is enclosed by double quotes. If it isn't only \w-_ are valid characters.

@ansgarm ansgarm requested a review from a team as a code owner September 17, 2024 14:23
@ansgarm ansgarm force-pushed the fix-block-label-brace branch 2 times, most recently from b112b70 to e82224f Compare September 17, 2024 14:31
@ansgarm ansgarm changed the title fix(hcl): don't parse expressions containing on open curly brace as blocks (TFECO-7531) fix(hcl): don't parse expressions containing on open curly brace as blocks Sep 18, 2024
@jpogran jpogran changed the title (TFECO-7531) fix(hcl): don't parse expressions containing on open curly brace as blocks (TFECO-7531) fix(hcl): don't parse expressions containing an open curly brace as blocks Sep 19, 2024
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@ansgarm ansgarm merged commit d1b19d3 into main Sep 20, 2024
5 checks passed
@ansgarm ansgarm deleted the fix-block-label-brace branch September 20, 2024 08:57
jpogran added a commit to hashicorp/vscode-terraform that referenced this pull request Sep 24, 2024
This commit updates the syntax version to 0.7.1, which fixes parsing expressions containing an open curly brace as blocks in hashicorp/syntax#149
jpogran added a commit to hashicorp/vscode-hcl that referenced this pull request Sep 24, 2024
This commit updates the syntax version to 0.7.1, which fixes parsing expressions containing an open curly brace as blocks in hashicorp/syntax#149
jpogran added a commit to hashicorp/vscode-terraform that referenced this pull request Sep 24, 2024
This commit updates the syntax version to 0.7.1, which fixes parsing expressions containing an open curly brace as blocks in hashicorp/syntax#149
jpogran added a commit to hashicorp/vscode-hcl that referenced this pull request Sep 24, 2024
This commit updates the syntax version to 0.7.1, which fixes parsing expressions containing an open curly brace as blocks in hashicorp/syntax#149
jpogran added a commit to hashicorp/vscode-terraform that referenced this pull request Sep 24, 2024
This commit updates the syntax version to 0.7.1, which fixes parsing expressions containing an open curly brace as blocks in hashicorp/syntax#149
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