Open nicolasparada opened 1 month ago
For the curious, this is how you can configure zed to use prettier with the go-template plugin:
npm i -g prettier prettier-plugin-go-template
{
"file_types": {
"HTML": ["tmpl"]
},
"languages": {
"HTML": {
"format_on_save": {
"external": {
"command": "prettier",
"arguments": [
"--stdin-filepath",
"{buffer_path}",
"--plugin",
"/opt/homebrew/lib/node_modules/prettier-plugin-go-template/lib/index.js"
]
}
}
}
}
}
You might want to change /opt/homebrew/lib/node_modules/prettier-plugin-go-template/lib/index.js
to whatever path the plugin was installed.
Check for existing issues
Language
go template
Tree Sitter parser link
https://github.com/ngalaiko/tree-sitter-go-template (not maintained).
Language server link
gopls has some support.
Misc notes
Add support for Go templates. See text/template and html/template.
Right now one can get sort of syntax highlight of HTML, but by doing so it messes and inlines the template interpolation parts.
I also tried using prettier with the go-template plugin and it works to some extend, but its tricky to configure for a non-js project.