GoLand has syntax support on Go html files with the file extension of .gohtml
So what about Go text files? Does GoLand support that as well? .tmpl
is supported by vim-go but not GoLand.
As mkopriva has already hinted and you have described as well in the comments, you can go to Preferences/Editor/File Types
and add your custom ending as Registered pattern
to the Go Template. But imo the real game changer is that you can also set Go as Template data language
there. This way even the Go syntax gets validated, not just the template syntax. It's still wonky, but definitly better than nothing.
Still, autoformatting does not work properly and can screw up your code. Therefore, you might also want to make sure the Reformat code
in the commit dialog is unchecked. Same with Optimize Imports
... better keep it unchecked.
there are two parts to this answer to get both html highlighting and go template highlighting
settings > editor > file types > select Go template files
from the list > update pattern to the file ending you use for your go templates. I used *.go.html
settings > template data languages > project language (dropdown at the top) > set to html
now you have both html highlighting and go template completion
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.