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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HCL/Terraform grammar to hashicorp/syntax #6802

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

dbanck
Copy link
Contributor

@dbanck dbanck commented Apr 25, 2024

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

CleanShot 2024-04-25 at 14 20 46@2x

After

CleanShot 2024-04-25 at 14 21 12@2x

Some edge case examples

Conditionals & Comments

Before

CleanShot 2024-04-25 at 14 21 31@2x

After

CleanShot 2024-04-25 at 14 09 44@2x

Function Calls

Before

CleanShot 2024-04-25 at 14 08 38@2x

After

CleanShot 2024-04-25 at 14 08 48@2x

Block Labels

Before

CleanShot 2024-04-25 at 14 23 25@2x

After

CleanShot 2024-04-25 at 14 23 46@2x

Happy to look into differences/bugs if you find any with the new grammar.

@dbanck dbanck requested a review from a team as a code owner April 25, 2024 13:07
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

Note: this PR will not be merged until close to when the next release is made. See here for more details.

@lildude lildude added this pull request to the merge queue Jun 7, 2024
Merged via the queue into github-linguist:master with commit d295f93 Jun 7, 2024
5 checks passed
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.

None yet

2 participants