fix django block parsing (for now) #31
Merged
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.
it's clear i need a rethink of parsing django block tags to nodes, becuase my mental picture of them differs from the actual use of them. E.g. I tend to think of them the same as HTML tags as either "void" tags or ones with end tags and children but not that's not the case at all. Some have intermediate tags (
{% if %}{% else %}{% endif %}) which is not a huge lift to support, but the mind blowing realization was that it's just convention that the closing tag starts withend.for builtin's, yeah that's it's the case that all of the tags that have opening and closing tags all close with a matching tag that is the initial tag with
endprefixed. but given the flexibility of the django template engine, a third-party could feasibly use any closing tag it wanted. that makes it very hard to build a structured, full-featured AST for a Django template.maybe that's not really needed for an LSP. but i'll need to come up with something eventually.