intellij-hcl
intellij-hcl copied to clipboard
No option to place closing bracket on new line when wrapping or chopping long arrays
Prerequisites
- [x] Ensure you have latest version of plugin installed
- [x] Search for possible issue duplicates
Installation details
- [x] IDE version (
Help->About->Copy to Clipboard
)GoLand 2018.3.4 Build #GO-183.5429.49, built on February 12, 2019 Licensed to Hyland Software Inc. / Nathan Lowe Subscription is active until November 17, 2019 JRE: 1.8.0_152-release-1343-b26 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0
- [x] intellij-hcl plugin version (
Settings->Plugins
)-
v0.6.13
-
- [x] Terraform version (
terraform -v
)-
Terraform v0.11.11
-
Terraform Configuration Files
variable "foo" {
type = "list"
default = ["a", "b", "c"]
}
Expected Behavior
When the default
array (or any array in general) gets too long and Chop down if long
is set in formatting settings, or if Wrap Always
is set in formatting settings, I expect the above code to be reformatted as follows:
variable "foo" {
type = "list"
default = [
"a",
"b",
"c"
]
}
Actual Behavior
The code is reformatted as follows:
variable "foo" {
type = "list"
default = [
"a",
"b",
"c"]
}
Note the closing ]
stays on the same line as the last element.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- Install the Terraform / HCL Plugin
- In Settings > Editor > Code Style > Terraform Config, under the
Wrapping and Braces
tab, setArrays
toWrap Always
. - Write the above hcl to
vars.tf
- Re-format the document (
Ctrl
+Alt
+Shift
+L
)
Notes
Other languages have the ability to control where the closing ]
gets places. For example, Javascript:
I found this because the rest of my team works with terraform manifests in VSCode. I was trying to get the formatting to match.
For now it's recommended to configure terraform fmt
file watcher and also performing it before committing changes.
Ah, I didn't know that was a thing. That's exactly what I'm looking for!
I have the terraform fmt
file watcher running but this bug is still very annoying. Is there a timeline on a fix?
This is annoying me as well! The problem with using terraform fmt
is that it formats a whole directory, rather than the specific file you're working with?
Also, I found that using terraform fmt
, the closing ']' stays on the same line as the last element as well! Seems odd, but there you go.