Skip to content

Commit

Permalink
Add blade templates support
Browse files Browse the repository at this point in the history
  • Loading branch information
lelgenio committed Feb 3, 2024
1 parent dc9ac18 commit 1f25d5f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,17 @@ indent = { tab-width = 4, unit = " " }
name = "php-only"
source = { git = "https://github.com/tree-sitter/tree-sitter-php", rev = "cf1f4a0f1c01c705c1d6cf992b104028d5df0b53", subpath = "php_only" }

[[language]]
name = "blade"
scope = "source.blade.php"
file-types = [{ suffix = ".blade.php" }, "blade"]
injection-regex = "blade"
roots = ["composer.json", "index.php"]

[[grammar]]
name = "blade"
source = { git = "https://github.com/EmranMR/tree-sitter-blade", rev = "4c66efe1e05c639c555ee70092021b8223d2f440" }

[[language]]
name = "twig"
scope = "source.twig"
Expand Down
8 changes: 8 additions & 0 deletions runtime/queries/blade/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
((directive_start) @start
(directive_end) @end.after
(#set! role block))


((bracket_start) @start
(bracket_end) @end
(#set! role block))
4 changes: 4 additions & 0 deletions runtime/queries/blade/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(directive) @tag
(directive_start) @tag
(directive_end) @tag
(comment) @comment
18 changes: 18 additions & 0 deletions runtime/queries/blade/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
((text) @injection.content
(#not-has-ancestor? @injection.content "envoy")
(#set! injection.combined)
(#set! injection.language php))

; could be bash or zsh
; or whatever tree-sitter grammar you have.
((text) @injection.content
(#has-ancestor? @injection.content "envoy")
(#set! injection.combined)
(#set! injection.language bash))


((php_only) @injection.content
(#set! injection.language php-only))
((parameter) @injection.content
(#set! injection.language php-only))

0 comments on commit 1f25d5f

Please sign in to comment.