Update HCL/Terraform grammar to hashicorp/syntax
#6802
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces the grammar for highlighting
.hcl
,.nomad
,.workflow
and Terraform (.tf
,.tfvars
) files with an updated one.We started maintaining HCL based grammars in hashicorp/syntax about 2 years ago and have fixed many edge cases since then. This grammar is also used in the vscode-hcl extension.
Another reason for this update proposal is, that Terraform 1.8 shipped with provider-defined functions. These are enabled by a
::
namespace syntax in HCL that isn't supported by the old grammar. The new grammar streamlines the highlighting for functions.I ran
script/add-grammar --replace Terraform.tmLanguage https://github.com/hashicorp/syntax
to generate most of the changes. The repository is already present as a submodule and was added in #6604.Let me know if I missed anything 🙂
Checklist
UX Changes (GithHub Dark Default)
Generic configuration
Before
After
Some edge case examples
Conditionals & Comments
Before
After
Function Calls
Before
After
Block Labels
Before
After
Happy to look into differences/bugs if you find any with the new grammar.