Skip to content

Commit

Permalink
Add pest support
Browse files Browse the repository at this point in the history
  • Loading branch information
erasin committed Apr 28, 2024
1 parent a1d7997 commit e1e243a
Show file tree
Hide file tree
Showing 6 changed files with 96 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 @@ -141,6 +141,7 @@
| passwd || | | |
| pem || | | |
| perl |||| `perlnavigator` |
| pest |||| `pest-language-server` |
| php |||| `intelephense` |
| php-only || | | |
| pkgbuild |||| `pkgbuild-language-server`, `bash-language-server` |
Expand Down
22 changes: 22 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ openscad-lsp = { command = "openscad-lsp", args = ["--stdio"] }
pasls = { command = "pasls", args = [] }
pbkit = { command = "pb", args = [ "lsp" ] }
perlnavigator = { command = "perlnavigator", args= ["--stdio"] }
pest-language-server = { command = "pest-language-server" }
prisma-language-server = { command = "prisma-language-server", args = ["--stdio"] }
purescript-language-server = { command = "purescript-language-server", args = ["--stdio"] }
pylsp = { command = "pylsp" }
Expand Down Expand Up @@ -3558,3 +3559,24 @@ language-servers = []
[[grammar]]
name = "move"
source = { git = "https://github.com/tzakian/tree-sitter-move", rev = "8bc0d1692caa8763fef54d48068238d9bf3c0264" }

[[language]]
name = "pest"
scope = "source.pest"
injection-regex = "pest"
file-types = ["pest"]
comment-tokens = ["//", "///", "//!"]
block-comment-tokens = { start = "/*", end = "*/" }
indent = { tab-width = 4, unit = " " }
roots = []
language-servers = ["pest-language-server"]

[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'

[[grammar]]
name = "pest"
source = { git = "https://github.com/pest-parser/tree-sitter-pest", rev = "a8a98a824452b1ec4da7f508386a187a2f234b85" }
49 changes: 49 additions & 0 deletions runtime/queries/pest/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(line_comment) @comment
(block_comment) @comment

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket

((identifier) @variable)
((builtin) @type.builtin)
((const) @constant)

[
(string)
(character)
] @string

[
"_"
"@"
"$"
]@keyword.storage.modifier

[
"~"
"|"
"="
"+"
"*"
"&"
"^"
"!"
"?"
".."
] @operator

[
"PUSH"
"PEEK"
"POP"
"SOI"
"EOI"
"ANY"
] @keyword

9 changes: 9 additions & 0 deletions runtime/queries/pest/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
(expression)
] @indent

[
"]"
"}"
")"
] @outdent
7 changes: 7 additions & 0 deletions runtime/queries/pest/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
((line_comment) @injection.content
(#set! injection.language "comment")
(#set! injection.include-children))

((block_comment) @injection.content
(#set! injection.language "comment")
(#set! injection.include-children))
8 changes: 8 additions & 0 deletions runtime/queries/pest/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(grammar_rule (_) @class.inside) @class.around
(term (_) @entry.inside) @entry.around

(line_comment) @comment.inside
(line_comment)+ @comment.around

(block_comment) @comment.inside
(block_comment)+ @comment.around

0 comments on commit e1e243a

Please sign in to comment.