Comments (7)
Hrmm, that is frustrating. I haven't played with the ternary operators yet and will need to investigate.
from vim-terraform.
i ran into this problem today with let g:terraform_align=1 set.
from vim-terraform.
I was wondering, but is this still reproducible? It seems to work fine with the example in OP, as used below:
resource "test" "hi" {
param = "${var.envtype == "prod" ? "" : var.envtype}"
}
I also tried adding random whitespace in the example and it reformatted to the above example.
]$ terraform --version
Terraform v0.12.4
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 4 2019 23:02:48)
from vim-terraform.
I'm thinking this was fixed in terraform >=0.12 and not a bug in this plugin itself. hashicorp/terraform#18458 (comment)
from vim-terraform.
This issue is nothing to do with the terraform binary - it's about formatting that the plugin does as you type, before terraform fmt
gets near to it.
from vim-terraform.
I think I found a solution to this problem thanks to https://stackoverflow.com/a/23840400.
If I create file.tf
with the contents
resource "test" "hi" {
param = "${var.envtype == "prod" ? "" : var.envtype}"
}
and then alter the file to have these contents
resource "test" "hi" {
param = "${var.envtype == "prod" ? "" : var.envtype}"
test = "${var.envtype == "prod" ? "" : var.envtype}"
}
By the time I enter a newline, the alignment is fixed and only the first =
is aligned
resource "test" "test1" {
param = "${var.envtype == "prod" ? "" : var.envtype}"
test = "${var.envtype == "staging" ? "" : var.envtype}"
}
rather than producing the broken string like the current implementation does
resource "test" "hi" {
param = "${var.envtype = = "prod" ? "" : var.envtype}"
}
from vim-terraform.
PR #105 will fix the issue. it safe to mergΡ it to the master. thanks.
from vim-terraform.
Related Issues (20)
- Is there a possibility to handle .hcl files HOT 1
- Allow hot-swapping of g:terraform_align HOT 3
- Format on save not working HOT 2
- Maintainer/Contributor
- Syntax highlighting for string interpolation should not match double dollar sign HOT 1
- automatic alignment does too much when we have blocks within blocks
- Add ability to autoformat hcl files on save HOT 2
- vim does not redraws after the terraform fmt HOT 3
- :wq (save and quit) takes 5 seconds when vim-terraform is loaded HOT 5
- Folding Not Working HOT 6
- Error detected while proccesing function <SNR>214_VimCloseCallBack[11]..<SNR>214_VimExitCallBack[22] HOT 4
- Question - TerraformFMT HOT 3
- terraform_fmt_on_save not working with in after/ftplugin/terraform.vim HOT 1
- FR: Use terraform syntax highlighting for terraform template .tftpl files HOT 5
- .tf filetype detection seems broken in more recent Vim/NeoVim versions? HOT 3
- Block comments converting to highlighted during navigation HOT 2
- Indenter overly detecting block comments inside of a heredoc HOT 1
- :Terraform command is absent HOT 1
- Enable commands for .hcl files HOT 1
- Add tenv / opentofu support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-terraform.