Closed baptman21 closed 11 months ago
Hi @baptman21, I merged https://github.com/ngalaiko/tree-sitter-go-template/pull/7 and thought that would improve the diff, but unfortunately there are some merge conflicts now, can you check if you can resolve them?
Hello, I used the default formatter of my lsp so it might not be the same as your changes, I'll rebase and redo the changes tomorrow so we get a better diff.
For now with the changes made to the repo, we don't seem to need the PR anymore I experimented and somehow with the current version and yaml injections with the combined type it is working perfectly, therefore the changes to the grammar don't seem necessary anymore.
I will close this PR for now and open another to add the injections configuration for helm in the doc.
Currently the grammar generates a lot of individual
(text)
blocks that if you use the injections are parsed separately. This means that the following will parse two texts, causing in both cases a color problemIgnoring the template part, the text is parsed into two texts blocks :
And
With the injection.combined option of tree-sitter all the text is passed to yaml fused, providing a better render.
To improve the perfs the grammar was also slightly modified to fuse
text
blocks that follow each other into one. The followingWill now be parsed as:
The tests have been updated for this case.
Edit: turns out that my optimization for the
(text)
node did not help because the main perf problem I was experiencing was due to the incremental selection of tree sitter. If you put everything on the same node the incremental selection is very slow. To fix this forhelm
files mainly I added a subblock to split text around the:
character. It gives the same render with thecombined
injections but is faster in large (> 2k lines without much templating and mostly text) files.PS: I know the repo is not maintained anymore so this PR does not need to be merged but at least there will be visibility.