这是indexloc提供的服务,不要输入任何密码
Skip to content

Respect comments and whitespace outside terraform blocks #6

@dylan-hoefsloot

Description

@dylan-hoefsloot

Is your feature request related to a problem? Please describe.
When using swipe to replace references in a terraform file, any whitespace and comments outside modules terraform blocks are removed.

Describe the solution you'd like
Respect existing whitespace and comments

Describe alternatives you've considered
Manually revert/unstage unwanted formatting changes (this is fine, just time consuming on larger projects).

Additional context
For example, this file input:

# This is a comment
resource "type" "name" {
  key = "value"
  
  # Comment in block
  another_key = "another_value"
}

resource "another_type" "another_name" {
  key = "value"
}

becomes this output:

resource "type" "name" {
  key = "value"

  # Comment in block
  another_key = "another_value"
}
resource "another_type" "another_name" {
  key = "value"
}

as you can see the whitespace and comments within the block is respected but anything outside is removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions