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

Use hash instead of double slashes for single line comments

Open jpenna opened this issue 1 year ago • 3 comments

HCL syntax accepts both # and // for line comments, but # is more idiomatic.

This is also mentioned in Terraform documentation:

The # single-line comment style is the default comment style and should be used in most cases. Automatic configuration formatting tools may automatically transform // comments into # comments, since the double-slash style is not idiomatic.

https://developer.hashicorp.com/terraform/language/syntax/configuration#comments

jpenna avatar Jul 25 '24 20:07 jpenna

CLA assistant check
All committers have signed the CLA.

hashicorp-cla-app[bot] avatar Jul 25 '24 20:07 hashicorp-cla-app[bot]

Hey @jpenna, thanks for your contribution!

The purpose of this extension is to provide generic syntax highlighting and limited language support for generic HCL files, not Terraform files. We have the fully featured Terraform Extension with backing Terraform Language Server to handle Terraform files, which does use # as the default line comment character.

The HCL sytanx specification purposely does not choose one comment style over the other. Each application (Boundary, Nomad, etc) is supposed to define what they consider idiomatic. Since this extension is targeted at any other HCL based language than Terraform, we have to conform to the generic HCL sytanx specification.

May I ask what you are using vscode-hcl for that vscode-terraform does not provide? We may be able to address that there instead of making this extension too coarsely purposed for the intended goal.

jpogran avatar Jul 29 '24 18:07 jpogran

Hello @jpogran , this was for settings, like .tflint.hcl. There was another file, but I deleted it, but I remember it was configuring something as well.

I understand what you are saying. Maybe this could be a setting for the vscode extension, since there are two ways of commenting and different projects might prefer one over the other.

jpenna avatar Jul 29 '24 23:07 jpenna

Thanks for the change! I am just using is, is great now! :1st_place_medal:

khaliddermoumi avatar Oct 29 '24 10:10 khaliddermoumi