NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹

Home Page:prettier-plugin-go-template-niklaspor.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newlines in Template Actions and Commands

apoorvmote opened this issue · comments

This was just released https://github.com/gohugoio/hugo/releases/tag/v0.81.0
Most prominant update on first line of list of all update is now the following is valid.

{{ dict 
	"country" "Norway" 
	"population" "5 millions"
	"language" "Norwegian"
	"language_code" "nb"
	"weather" "freezing cold"
	"capitol" "Oslo"
	"largest_city" "Oslo"
	"currency"  "Norwegian krone"
	"dialing_code" "+47" 
}}

Its not super urgent but adding support for this would be nice.
Also just wanted to tell you that I am really loving this pacakge. Only reason I switched to prettier is for word wrap feature. Since I switched to tailwindcss the lines are getting really long and built in VS Code word wrap is failing on me. So any word wrap is very important to me. Like the new feature above.
Many thanks for creating this pacakge.

Hi, thanks for opening an issue for this 👍

I'll try to handle this inside the AST Rewrite #49 that also adds support for else blocks.

@apoorvmote prettier-plugin-go-template@0.0.11-beta.11 implements this feature:

input

<div>
<div>
{{ dict
"country" "Norway"
"population" "5 millions"
"language" "Norwegian"
"language_code" "nb"
"weather" "freezing cold"
"capitol" "Oslo"
"largest_city" "Oslo"
"currency"  "Norwegian krone"
"dialing_code" "+47"
}}
</div>
</div>

output

<div>
  <div>
    {{ dict
      "country" "Norway"
      "population" "5 millions"
      "language" "Norwegian"
      "language_code" "nb"
      "weather" "freezing cold"
      "capitol" "Oslo"
      "largest_city" "Oslo"
      "currency"  "Norwegian krone"
      "dialing_code" "+47"
    }}
  </div>
</div>

@NiklasPor Thanks for creating this feature. I am not adventurous beta testing guy. So I will test out when you merge with master.