Support for Go template engine (plugin documentation).
Included In
What’s New
Rating & Reviews
One issue is the conflict between tabs. I'm using Templates for code generation, for Go and other languages. It's possible to bind other format, but the alignment of the items conflicts. I think it should have a option to either priority the padding/tabs from the selected language or the Template.
This plugin would be about 5x better for new users with some instructions of what's possible. Here, let me help.
- Create an extension for your templates. If they are HTML,
*.gohtml
is already defined for you. Settings | Editor | File Types
has the place to add your template type. The hidden gem: once started, there is a popup for the type of the underlying template. So I created*.goyaml
and then told it these underlying type of the file was YAML. Voila, language sensitive rendering.- Learn how to use
gotype
annotations on your templates: https://blog.jetbrains.com/go/2018/12/14/go-templates-made-easy/. Of course that's a Jetbrains blog, so it doesn't actually tell you what those annotations are. They basically are the cue for the editor to tell what kind of object is at the root of the instance hierarchy provided at thetemplate.Template.Execute
call. Voila, template source objects are context-aware.
Now you can actually get some work done. w00t w00t!
Richard Brus
12.12.2023It's working great for me. Use it to deal with Hugo Go code inside of HTML templates. Definitely helps a lot - thanks!