ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.91k stars 119 forks source link

TMPL file not supported? #424

Open florentsorel opened 5 months ago

florentsorel commented 5 months ago

I try to have .tmpl file working but nothing work. I've read this PR but it doesn't work for me.

.tmpl file image

.html file image

shunwatai commented 4 months ago

I also have similar issue, LSP detects the .tmpl file as gotexttmpl instead of gohtmltmpl. image

I have to manually set the filetype to gohtmltmpl everytime. image

Is there anyway to auto detect my html template as gohtmltmpl?

florentsorel commented 4 months ago

I find a solution. Try to create .gohtml file and this extension is set to gohtmltmpl filetype.
Works for me.

shunwatai commented 4 months ago

I find a solution. Try to create .gohtml file and this extension is set to gohtmltmpl filetype. Works for me.

it works, thanks for your advice. i am wondering is there any way to detect the correct file type without changing the file extension.

ray-x commented 4 months ago

A good reference on setting with treesitter is here: https://github.com/ngalaiko/tree-sitter-go-template?tab=readme-ov-file

jthvai commented 4 months ago

@ray-x Where did you read that Neovim is deprecating non-treesitter based syntax highlighting? I can't seem to find any information on it :/

(This seemed like the right place to ask as 05ba8a9 references this issue)

ray-x commented 4 months ago

Please check this comment.

https://github.com/nvim-treesitter/nvim-treesitter/issues/2846#issuecomment-1104790065

jthvai commented 4 months ago

That comment doesn't indicate a deprecation of the Vim syntax engine (I did also confirm in the Neovim matrix chat that no deprecation is planned) - or even a change of any particular feature that would impact the Vim syntax engine.

Are you referring to the Vim syntax engine being referred to as "legacy"? In my experience, "legacy" may mean "superseded" (there is a better option where applicable), but does not itself imply that the system is deprecated. Particularly in the case of Neovim, such a large deprecation would want for an extremely prominent and official notice, and would - going by the API contract - probably not be actually removed until 2 major versions from now (v2).

It seems unlikely that Neovim would deprecate the Vim syntax engine any time in the forseeable future, as there are still several if not many commonly used languages that do not have treesitter parsers, some of which are not representable with CFGs.