diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index d66f7bef1..e69d1d840 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -180,6 +180,7 @@ | prolog | ✓ | | ✓ | `swipl` | | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` | | prql | ✓ | | | | +| pug | ✓ | | | | | purescript | ✓ | ✓ | | `purescript-language-server` | | python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` | | qml | ✓ | | ✓ | `qmlls` | diff --git a/languages.toml b/languages.toml index c44765ad9..b28a0c150 100644 --- a/languages.toml +++ b/languages.toml @@ -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" } diff --git a/runtime/queries/pug/highlights.scm b/runtime/queries/pug/highlights.scm new file mode 100644 index 000000000..3e5c66fe0 --- /dev/null +++ b/runtime/queries/pug/highlights.scm @@ -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) +) diff --git a/runtime/queries/pug/injections.scm b/runtime/queries/pug/injections.scm new file mode 100644 index 000000000..328787f57 --- /dev/null +++ b/runtime/queries/pug/injections.scm @@ -0,0 +1,3 @@ +((javascript) @injection.content + (#set! injection.language "javascript") +)