-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tree-sitter-htmldjango #3249
Changes from all commits
c9aecc2
281b317
306de03
5901995
daf681b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -423,6 +423,18 @@ indent = { tab-width = 2, unit = " " } | |||||
name = "html" | ||||||
source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "d93af487cc75120c89257195e6be46c999c6ba18" } | ||||||
|
||||||
[[language]] | ||||||
name = "htmldjango" | ||||||
scope = "source.htmldjango" | ||||||
injection-regex = "htmldjango" | ||||||
file-types = ["html"] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this entry beats regular html for [[language]]
name = "html"
file-types = []
[[language]]
name = "htmldjango"
file-types = ["html"] Since HTML is more popular than django I think we should disable this language by default
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it beats There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wait, it doesn't. Maybe we should apply it conditionally based on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was also under the impression that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be fixed now, but I am still a bit not quite happy with the result that the ordering is a bit messy (it will take the first glob that matches the path and have the root within the path). Some parts of it were taken from #2455, but I haven't updated the docs yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be fixed now, but I am still a bit not quite happy with the result that the ordering is a bit messy (it will take the first glob that matches the path and have the root within the path). Some parts of it was taken from #2455, but I haven't updated the docs yet. |
||||||
roots = ["manage.py"] | ||||||
indent = { tab-width = 2, unit = " " } | ||||||
|
||||||
[[grammar]] | ||||||
name = "htmldjango" | ||||||
source = { git = "https://github.com/interdependence/tree-sitter-htmldjango", rev = "184a50456186c2ff49b9b410f7060a176e2a3080" } | ||||||
|
||||||
[[language]] | ||||||
name = "python" | ||||||
scope = "source.python" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
(unpaired_comment) | ||
(paired_comment) | ||
] @comment | ||
|
||
[ | ||
"{{" | ||
"}}" | ||
"{%" | ||
"%}" | ||
(end_paired_statement) | ||
] @tag | ||
|
||
"end" @keyword.return | ||
|
||
(variable_name) @variable | ||
(filter_name) @function.macro | ||
(filter_argument) @variable.parameter | ||
(tag_name) @function | ||
(keyword) @keyword | ||
(operator) @operator | ||
(keyword_operator) @keyword.directive | ||
(number) @constant.numeric | ||
(boolean) @constant.builtin.boolean | ||
(string) @string |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(paired_statement) @indent | ||
(end_paired_statement) @outdent | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about this again, not sure if we want this since vim does not indent django paired statements. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
((content) @injection.content | ||
(#set! injection.language "html") | ||
(#set! injection.combined)) | ||
|
||
([(unpaired_comment) (paired_comment)] @injection.content | ||
(#set! injection.language "comment")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite know why are we not using
Path
here, but I don't feel like changing this here.