hashicorp / vscode-hcl

HCL (HashiCorp Configuration Language) Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=HashiCorp.HCL
Mozilla Public License 2.0
49 stars 10 forks source link

Allow using "#" for line comments #313

Closed khaliddermoumi closed 1 month ago

khaliddermoumi commented 3 months ago

Please support using "#" as the line comment character.

So far, the extension uses only "//", and there seems to be no way to configure this. As "#" is the typical line comment character in Terraform, when using this extension with TF, it would be very desirable to have "#" in the hcl files too.

jpogran commented 2 months ago

Hi @khaliddermoumi, this extension is not meant to be used for Terraform (.tf) files, as described in the README. This extension uses the official HCL library rules as defined here: hclsyntax/spec.md which state no preference for which to use. There is no way to configure this, because VS Code itself does not provide a way for a user to do this.

The official HashiCorp Terraform Extension uses # as the line comment symbol. We strongly recommend you use vscode-terraform to edit Terraform files. May I ask why you are using the HCL extension for Terraform files?

khaliddermoumi commented 2 months ago

Hi @jpogran!

I am using the extension to edit terragrunt files (.hcl), which are authored in terraform syntax. You can't use the dedicated TF extension for this, as it would validate the terragrunt specific parts as "errors". vscode-hcl is the better choice, but it should use the "#" comment symbol for TF code (just like the TF extension).

I am sure this is a common issue, as terragrunt is widely used by TF users.

suburbanworrier commented 2 months ago

Hi

I recently burnt way too much time trying to sort out what extensions are required for my new laptop to work on a Terragrunt project. I thought I'd got it sorted when I installed this one but the double slash comments are driving me insane as all of the code I'm working with is chock full of # comments.

@jpogran says:

the official HCL library rules ... state no preference for which to use

and

The official HashiCorp Terraform Extension uses #

so who decided this one must use //?

Please, please make it configurable or just change to the more widely used #.

dbanck commented 1 month ago

After some consideration and the discussion in this issue, we've decided to make # the default character for line comments.

This change will be part of the upcoming 0.6.0 release.