Add support for Pug language (#13435)

pull/13458/head
Spenser Black 2025-05-05 09:57:00 -04:00 committed by GitHub
parent ece12dd74d
commit 4784650ccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 112 additions and 0 deletions

View File

@ -180,6 +180,7 @@
| prolog | ✓ | | ✓ | `swipl` |
| protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` |
| prql | ✓ | | | |
| pug | ✓ | | | |
| purescript | ✓ | ✓ | | `purescript-language-server` |
| python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` |
| qml | ✓ | | ✓ | `qmlls` |

View File

@ -4313,3 +4313,14 @@ comment-tokens = "#"
[[grammar]]
name = "debian"
source = { git = "https://gitlab.com/MggMuggins/tree-sitter-debian", rev = "9b3f4b78c45aab8a2f25a5f9e7bbc00995bc3dde" }
[[language]]
name = "pug"
scope = "source.pug"
file-types = ["pug"]
comment-tokens = ["//", "//-"]
indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "pug"
source = { git = "https://github.com/zealot128/tree-sitter-pug", rev = "13e9195370172c86a8b88184cc358b23b677cc46" }

View File

@ -0,0 +1,97 @@
(comment) @comment
(
doctype
(("doctype") @keyword.storage.type)
((doctype_name) @type.enum.variant)
)
(tag_name) @constant
; Attributes
(id) @attribute
(class) @attribute
(attribute_name) @attribute
(quoted_attribute_value) @string
; Controls
(
conditional
((keyword) @keyword.control.conditional)
)
(
case
((keyword) @keyword.control)
(
when
((keyword) @keyword.control)
)
)
(
each
((keyword) @keyword.control.repeat)
)
(
else
((keyword) @keyword.control.conditional)
)
(
while
((keyword) @keyword.control.repeat)
)
; Mixins
(
mixin_definition
((keyword) @keyword.function)
((mixin_name) @function.method)
)
(
mixin_use
(("+") @operator)
((mixin_name) @function.method)
)
; Includes
(
include
((keyword) @keyword.directive)
((filename) @string.special.path)
)
; Inheritance
(
extends
((keyword) @keyword.directive)
((filename) @string.special.path)
)
(
block_definition
((keyword) @keyword.directive)
((block_name) @function.method)
)
(
block_append
((keyword) @keyword.directive)
((block_name) @function.method)
)
(
block_prepend
((keyword) @keyword.directive)
((block_name) @function.method)
)
; Filters
(
filter
(":" @function.macro)
((filter_name) @function.macro)
((content) @special)
)
; Inline JavaScript
(
unbuffered_code
(("-") @special)
)

View File

@ -0,0 +1,3 @@
((javascript) @injection.content
(#set! injection.language "javascript")
)