Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform-format-buffer does not respect terraform-indent-level #18

Closed
indradhanush opened this issue Apr 24, 2017 · 2 comments
Closed

Comments

@indradhanush
Copy link

Steps to reproduce:

  1. Set terraform-indent-level to 4 (default is 2)
  2. Run terraform-format-buffer on a .tf file

The mode indents the buffer at level 2 instead of 4.

This will also fix terraform-format-on-save.

@indradhanush
Copy link
Author

On second thoughts, there is not much that terraform-format-buffer can do because it uses terraform fmt internally. And it does not appear that terraform fmt accepts custom indentation levels at the moment.

However, one alternative could be to readjust the indentation after terraform fmt has done its magic. Thoughts?

@Fuco1
Copy link
Collaborator

Fuco1 commented Mar 1, 2023

I did what you suggested in the second comment. If the level is different from 2, after replacing the buffer with the formatted text I run indent-region on the entire buffer which will re-indent to 4 or whatever you set.

@Fuco1 Fuco1 closed this as completed in 4de0bc4 Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants