vrischmann / tree-sitter-templ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

indents support

AnthonyPoschen opened this issue · comments

Hi, i have been on a bit of a mission getting templ the way i like downstream.

windwp/nvim-ts-autotag#154
windwp/nvim-ts-autotag#155

which has now lead me upstream to needing the default indenting in templ to be correct for my OCD of feature completeness.

Screen.Recording.2024-01-21.at.9.56.01.pm.mov

I have only just looked into treesitter and its syntax stuff now, is their any plans on indent support soonish and if not, how could i figure out how to contribute such a feature.

Hi.

I don't have any specific plans to add indent support because I don't need it, but I could look into it someday.

As far as I understand to add indent support you would need to add a indents.scm query file to nvim-treesitter, like there is for Go.
And then enable indent support.

So I don't think there's anything to do with the parser.

I gave it a try for about 2 hours (see here, copied/adapted the queries from HTML) but it doesn't work and I don't understand why.

I'll probably come back to this when the feature is less experimental.

i also did give it a try last night, but wasn't sure if i had everything setup correctly or it just didn't work. I will look at that and see what i can do

so i placed what you supplied inside my ~/.config/nvim/after/queries/templ/indents.scm
and it worked right out of the box!

its got a bit of qwerks to it, but its mostly working as intended.

Screen.Recording.2024-01-22.at.8.42.08.pm.mov

thanks for testing. It's weird that it doesn't work for me.

Hi @AnthonyPoschen. is this still a problem for you or can I close this issue ?