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 within actions does not format correctly

andreseduardop opened this issue · comments

Support for newlines within actions and pipelines was added in Go version 1.16 and Hugo release 0.81.
It would be useful if the format was kept or converted correctly.

Problem

This:

{{ dict 
    "country" "Norway" 
    "population" "5 millions" 
}}

is converted to:

{{ dict"country" "Norway""population" "5 millions"}}

Some spaces are needed. 👀

Expected result

Keep the formatting or (preferably) convert it to a line with the appropriate spaces.

{{ dict "country" "Norway" "population" "5 millions"}}

Note

In longer strings, when multiple lines are kept, this problem does not occur and the formatting is set correctly.

Something like this, no problem.

{{ dict
  "country" "Norway"
  "population" "5 millions"
  "language" "Norwegian"
  "dialing_code" "+47"
}}

Fixed in prettier-plugin-go-template@0.0.11-beta.14. Thanks for reporting this 👍