changeset 6763:2c72491f5187

Add support for Pug language (#13435)
author Spenser Black <spenserblack01@gmail.com>
date Mon, 05 May 2025 09:57:00 -0400
parents fc53938e16fd
children 7594cb9ce89f
files book/src/generated/lang-support.md languages.toml runtime/queries/pug/highlights.scm runtime/queries/pug/injections.scm
diffstat 4 files changed, 112 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/book/src/generated/lang-support.md	Mon May 05 09:20:57 2025 -0400
+++ b/book/src/generated/lang-support.md	Mon May 05 09:57:00 2025 -0400
@@ -180,6 +180,7 @@
 | prolog | ✓ |  | ✓ | `swipl` |
 | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` |
 | prql | ✓ |  |  |  |
+| pug | ✓ |  |  |  |
 | purescript | ✓ | ✓ |  | `purescript-language-server` |
 | python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` |
 | qml | ✓ |  | ✓ | `qmlls` |
--- a/languages.toml	Mon May 05 09:20:57 2025 -0400
+++ b/languages.toml	Mon May 05 09:57:00 2025 -0400
@@ -4313,3 +4313,14 @@
 [[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" }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/pug/highlights.scm	Mon May 05 09:57:00 2025 -0400
@@ -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)
+)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/queries/pug/injections.scm	Mon May 05 09:57:00 2025 -0400
@@ -0,0 +1,3 @@
+((javascript) @injection.content
+  (#set! injection.language "javascript")
+)