vscode-hcl icon indicating copy to clipboard operation
vscode-hcl copied to clipboard

`}}/*` treated as comment

Open nimdeveloper opened this issue 1 year ago • 4 comments

I'm using version 0.5.0 of HashiCorp HCL extension and vault policy config but have syntax highlighting issues. image Config:

// For KV storage
path "sample/metadata/project_{{identity.entity.metadata.project_id}}/*" {
    capabilities = ["read", "list"]
}
path "sample/data/${var.secrets_base_path}/*" {
    capabilities = ["read", "list"]
}

Here is some info that may help: image image

nimdeveloper avatar Aug 29 '24 21:08 nimdeveloper

Hi @nimdeveloper, can you verify that its the HashiCorp HCL extension that is active, and there aren't any other extensions that may be contributing HCL features?

I created a file with an HCL extension and could not reproduce the issue:

image

jpogran avatar Aug 30 '24 15:08 jpogran

That's weird, I also tried on another system, and the same thing happened. I also have the Terraform extension, what I'm doing is that I have some resources for the Vault in my Terraform code. I'm using these policy files using the templatefile func, so basically, I need both extensions as the Terraform extension doesn't support (at least) the syntax highlighting for HCL files. but as soon as I enable the terraform extension, the syntax is broken. Am I doing something wrong here? Shouldn't I install the HCL extension with Terraform? Also, I selected HCL language for these files in VSCode language mode

nimdeveloper avatar Sep 02 '24 19:09 nimdeveloper

Thanks for the added context, I misunderstood your use case in your original post. The bad news is, I was able to replicate your experience using that description.

The good news is we have a release slated later this week that will fix the issue for you.

The reason this was occurring is that both the Terraform and HCL extensions ship HCL syntax highlighting, but the fix for this particular issue was not released in the Terraform extension yet. VS Code's extension activation logic is non-deterministic, which means sometimes we do not control which provides functionality at any one point in time. Unfortunately in this case the Terraform extension activated first and provided the older grammar.

jpogran avatar Sep 03 '24 17:09 jpogran

v2.32.3 has been released, which includes the latest syntax files. This should fix your issue. Please let us know if it does not.

jpogran avatar Sep 06 '24 18:09 jpogran

Thanks.

nimdeveloper avatar Dec 12 '24 12:12 nimdeveloper