cmur2 / language-terraform

Terraform.io support for Atom
MIT License
49 stars 32 forks source link

Syntax hightlight issue #27

Closed zambon closed 7 years ago

zambon commented 7 years ago

Using multiline strings breaks the syntax highlight, unless the termination string is placed at the begining of the line. For example:

A)

variable "description" {
  default = <<EOF
  Insert long text here.
  EOF
}

resource "..." "..." {
  // ...
}

B)

variable "description" {
  default = <<EOF
  Insert long text here.
EOF
}

resource "..." "..." {
  // ...
}

C)

variable "description" {
  default = <<-EOF
  Insert long text here.
  EOF
}

resource "..." "..." {
  // ...
}

Highlight breaks in snippet A, but works in B and C

GiantToast commented 7 years ago

From the docs: Multiline strings can use shell-style "here doc" syntax, with the string starting with a marker like <<EOF and then the string ending with EOF on a line of its own. The lines of the string and the end marker must not be indented.

zambon commented 7 years ago

And yet, C works just fine. 😏

GiantToast commented 7 years ago

C works fine because the <<-EOF isn't being interpreted as the beginning of a multiline string. It should exactly be <<EOF. At least that is my theory anyway.

zambon commented 7 years ago

The difference - makes is that the whitespaces in the indentation are ignored. For example, all * below are not part of the resulting string.

variable "description" {
  default = <<EOF
**Insert long text here.
**EOF
}

Anyway, the point I was trying to make is that although one could argue that EOF should be at the very beginning of the line, the flexibility of having A work would be appreciated! 😊

jk563 commented 7 years ago

Most places I've seen (all the ones I can remember at least) examples of the usage of heredocs place the EOF without any indentation, I'd rather the highlighter stuck with that.