VladRassokhin / intellij-hcl

HCL language support for IntelliJ platform based IDEs
Apache License 2.0
244 stars 48 forks source link

Variable tooltip descriptions not formatted correctly with heredocs #379

Open kriswuollett opened 2 years ago

kriswuollett commented 2 years ago

Tooltip for variable descriptions that use heredoc is not formatted correctly when indented, or not shown at all if not indented. It could be related that Terraform itself may include the heredoc delimiters in its console output, but for an IDE it should be formatted properly. I'm not expecting the level of functionality like the IntelliJ Java reference information, but I do expect that embedded newlines and tabs should be processed along with those implied from heredoc should be applied to get a readable description in HCL tooltips. A nice to have would be Markdown formatting.

Prerequisites

Installation details

JetBrains Rider 2021.3.3
Build #RD-213.6775.4, built on January 26, 2022
Licensed to Kristopher Wuollett
You have a perpetual fallback license for this version.
Subscription is active until January 4, 2023.
Runtime version: 11.0.13+7-b1751.25 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 12.1
.NET 6.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 1500M
Cores: 16
Registry:
    ide.new.project.model.index.case.sensitivity=true
    indexing.enable.entity.provider.based.indexing=false
    rdclient.asyncActions=false

Non-Bundled Plugins:
    com.intellij.resharper.StructuredLogging (2021.3.0.177)
    org.intellij.plugins.hcl (0.7.15)
    PythonCore (213.6461.82)
    mobi.hsz.idea.gitignore (4.3.0)

Use cases

With indent:

variable "my_var" {
  description = <<-EOT
  The generic variable, with parameters:

  - name: The name of the object. 
  EOT
  type = object({
    name = string
  })
}

image

Without indent:

variable "my_var" {
  description = <<EOT
The generic variable, with parameters:

- name: The name of the object. 
EOT
}

image

With embedded newlines:

image