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 7, 2024
1 parent 4be7aae commit 0cbd556
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| beancount || | | |
| bibtex || | | `texlab` |
| bicep || | | `bicep-langserver` |
| blade || | | |
| blueprint || | | `blueprint-compiler` |
| c |||| `clangd` |
| c-sharp ||| | `OmniSharp` |
Expand Down
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 0cbd556

Please sign in to comment.