NiklasPor / prettier-plugin-go-template

Fixes prettier formatting for go templates 🐹
prettier-plugin-go-template-niklaspor.vercel.app
MIT License
308 stars 22 forks source link

Prettier PR for VSCoder users? #58

Open cameronelliott opened 2 years ago

cameronelliott commented 2 years ago

This seems like a fantastic project, thanks for implementing it.

I am more of a backend Go developer, and try to stay away from NPM/Yarn, Rollup, etc, etc

It would be really wonderful if this was part of Prettier, and so every VSCode user could this plugin without having to touch NPM. Just by using a standard VScode extension: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode (NPM is great, until you do something wrong, and you don't know how to fix it)

Maybe it is not meant to be due to do logistical reasons, but I wanted to throw it out there, in case.

cameronelliott commented 2 years ago

One more thought, an example of a test-case in the README that shows a before & after example, so users unfamiliar with prettier-plugin-go-template can see if they have installed it correctly would be super helpful.

For example, in my case, I did:

And if I now run:

npx prettier sample.html

with the input: sample.html

<html>
<script>
{{if }}
Whatever.
{{else }}
Psych.
{{end }}
</script>
</html>

I get the following on Stdout:

<html>
<script>
{{if }}
Whatever.
{{else }}
Psych.
{{end }}
</script>
</html>

Which seems wrong, (it is unindented to start) but I am so unfamiliar with npm/npx, I don't know the issue.

cameronelliott commented 2 years ago

I just found this: https://github.com/prettier/prettier/issues/6034 😢

cameronelliott commented 2 years ago

Okay, I guess my test cases are failing because the {{foo}} inside the Githubissues.

  • Githubissues is a development platform for aggregating issues.