VladRassokhin / intellij-hcl

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

Feature - Add support for formating hcl code inside markdown files #319

Open remyleone opened 3 years ago

remyleone commented 3 years ago

Prerequisites

Installation details

GoLand 2020.3 Build #GO-203.5981.98, built on November 25, 2020 Runtime version: 11.0.9+11-b1145.21 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.16 GC: ParNew, ConcurrentMarkSweep Memory: 1088M Cores: 12 Registry: ide.completion.variant.limit=500, suggest.all.run.configurations.from.context=true Non-Bundled Plugins: org.intellij.plugins.hcl, com.intellij.kubernetes, org.toml.lang, PythonCore, idea.plugin.protoeditor, org.rust.lang

0.7.10

Terraform v0.14.2

Expected Behavior

When I'm editing a markdown files, I sometimes have snippets of code included that are in HCL (terraform configuration language). I would like to have a shortcut to use terraform fmt on those snippets directly inside the markdown.

While I can copy and paste those snippets to a scratch file and apply the terraform fmt there using the Hashicorp plugin, it would be useful to be able to have in the context of a block such as:


# My Mardown is here

```hcl # <= I would like to terraform fmt this snippet
resource "scaleway_instance_security_group" "sg01" { 
external_rules = true 
} 

resource "scaleway_instance_security_group_rules" "sgrs01" { 
security_group_id = scaleway_instance_security_group.sg01.id 
inbound_rule { 
action = "accept" 
port = 80 
ip_range = "0.0.0.0/0" 
} 
}