Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go text template syntax highlighting in GoLand

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.

like image 891
Jim yu Avatar asked Dec 17 '22 18:12

Jim yu


1 Answers

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.

enter image description here

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.

like image 98
NotX Avatar answered Jan 11 '23 12:01

NotX