Issue #14: Adds rudimentary twig indentation #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends basic html indentation so that at least HTML code in twig templates will indent correctly.
You get results like this:
And for a more HTML heavy file, the referenced base:
Prior to this change, re-indenting the file would collapse all tags to the left side, so while this isn't great, its better.
This could possible close #14 but I would love to get better indentation for the actual Twig tags themselves. With this change the HTML at least indents when using
=
, but the twig it self (blocks, for loops, if statements, etc) don't get any indentation.I started adding things like
to the file, inspired by looking at other examples:
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/scss/indents.scm
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/ruby/indents.scm
I am still playing with it to see if I can get typical twig grammar parts to indent, but I wanted to get the ball rolling as this appears to be a way to get treesitter to start indenting the files.