VsCode syntax highlighting for tmpl files

4,082 views
Skip to first unread message

cinem...@gmail.com

unread,
Sep 23, 2019, 11:25:52 AM9/23/19
to golang-nuts

Is there way to highlight templates files (.tmpl) in VSCode? There is an extension gotemplate-syntax but seems it doesn't make the job.


{{define "side"}}
    <h3>New Books</h3>
    <p>There's nothing here</p>
{{end}}

Subramanian Sridharan

unread,
Sep 24, 2019, 1:32:55 AM9/24/19
to golang-nuts
Nunjucks seems to do the trick.


ext install extension nunjucks

When you save a file with some file extension, VSCode automatically prompts you to install a related VSCode extension.
That's how I came to know about this extension. 

cinem...@gmail.com

unread,
Sep 24, 2019, 3:00:22 AM9/24/19
to golang-nuts
thnks, it's better than nothing

Denis Bakhtin

unread,
Sep 25, 2019, 10:18:51 AM9/25/19
to golang-nuts
This extension works well if templates have .gohtml extension. I had to rename mine.

Andreas

unread,
Sep 28, 2019, 11:19:20 AM9/28/19
to golang-nuts
nice

Andreas

unread,
Oct 13, 2019, 11:49:58 AM10/13/19
to golang-nuts
the drawback is when I enter in .gohtml file

```{{```

then vscode auto-copletes it with

```}}}```

did you get the same?


On Wednesday, September 25, 2019 at 5:18:51 PM UTC+3, Denis Bakhtin wrote:

Soyaib Zihad

unread,
Mar 15, 2024, 1:40:30 PM3/15/24
to golang-nuts
"files.associations": {
"*.tmpl": "html"
}
add this to settings.json in vs-code and life is good.
Reply all
Reply to author
Forward
0 new messages