diff options
| author | Riley Bruins <ribru17@hotmail.com> | 2025-07-19 02:36:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-19 11:36:38 +0200 |
| commit | fba060b623f32c6d2e72a2d2954beb87433aecea (patch) | |
| tree | 03eb1fd73dbf4c0aca81a714157c49caa38054f3 /runtime/queries/pkl | |
| parent | feat(groq): add parser and queries (#8008) (diff) | |
| download | nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar.gz nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar.bz2 nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar.lz nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar.xz nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.tar.zst nvim-treesitter-fba060b623f32c6d2e72a2d2954beb87433aecea.zip | |
feat(pkl): add parser and queries (#8011)
Diffstat (limited to 'runtime/queries/pkl')
| -rw-r--r-- | runtime/queries/pkl/folds.scm | 6 | ||||
| -rw-r--r-- | runtime/queries/pkl/highlights.scm | 203 | ||||
| -rw-r--r-- | runtime/queries/pkl/injections.scm | 6 |
3 files changed, 215 insertions, 0 deletions
diff --git a/runtime/queries/pkl/folds.scm b/runtime/queries/pkl/folds.scm new file mode 100644 index 000000000..385c4ceb9 --- /dev/null +++ b/runtime/queries/pkl/folds.scm @@ -0,0 +1,6 @@ +[ + (clazz) + (objectBody) +] @fold + +(importClause)+ @fold diff --git a/runtime/queries/pkl/highlights.scm b/runtime/queries/pkl/highlights.scm new file mode 100644 index 000000000..bc7e72757 --- /dev/null +++ b/runtime/queries/pkl/highlights.scm @@ -0,0 +1,203 @@ +(identifier) @variable + +(qualifiedAccessExpr + (identifier) @function.method.call + . + (argumentList)) + +(qualifiedAccessExpr + (identifier) @variable.member .) + +; Operators +[ + "??" + "@" + "=" + "<" + ">" + "!" + "==" + "!=" + "<=" + ">=" + "&&" + "||" + "+" + "-" + "**" + "*" + "/" + "~/" + "%" + "|>" + "..." + "|" + "->" +] @operator + +[ + "," + ":" + "." + "?." +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Types +(clazz + (identifier) @type.definition) + +(typeAlias + (identifier) @type.definition) + +((identifier) @type + (#lua-match? @type "^[A-Z]")) + +(typeArgumentList + [ + "<" + ">" + ] @punctuation.bracket) + +; Method definitions +(classMethod + (methodHeader + (identifier) @function.method)) + +(objectMethod + (methodHeader + (identifier) @function.method)) + +; Identifiers +(classProperty + (identifier) @property) + +(objectProperty + (identifier) @property) + +(parameterList + (typedIdentifier + (identifier) @variable.parameter)) + +(objectBodyParameters + (typedIdentifier + (identifier) @variable.parameter)) + +; Literals +[ + (stringConstant) + (slStringLiteralExpr) + (mlStringLiteralExpr) +] @string + +(escapeSequence) @string.escape + +(intLiteralExpr) @number + +(floatLiteralExpr) @number.float + +(stringInterpolation + [ + "\\(" + "\\#(" + "\\##(" + "\\###(" + "\\####(" + "\\#####(" + "\\######(" + ] @punctuation.special + ")" @punctuation.special) + +(nullableType + "?" @punctuation.special) + +[ + (lineComment) + (blockComment) +] @comment @spell + +(docComment) @comment.documentation @spell + +(shebangComment) @keyword.directive + +; Keywords +[ + "abstract" + "external" + "for" + "is" + "let" + "new" + "out" +] @keyword + +"function" @keyword.function + +[ + "as" + "in" +] @keyword.operator + +[ + "typealias" + "class" + "module" +] @keyword.type + +[ + "import" + "import*" + "amends" + "extends" +] @keyword.import + +[ + "when" + "if" + "else" +] @keyword.conditional + +(modifier) @keyword.modifier + +(importExpr + [ + "import" + "import*" + ] @function.builtin) + +(moduleExpr + "module" @type.builtin) + +[ + (outerExpr) + "super" + (thisExpr) +] @variable.builtin + +[ + "read" + "read?" + "read*" + "throw" + "trace" +] @function.builtin + +(nullLiteralExpr) @constant.builtin + +[ + (falseLiteralExpr) + (trueLiteralExpr) +] @boolean + +(newExpr + (declaredType + (qualifiedIdentifier + (identifier) @constructor .))) diff --git a/runtime/queries/pkl/injections.scm b/runtime/queries/pkl/injections.scm new file mode 100644 index 000000000..9d563b440 --- /dev/null +++ b/runtime/queries/pkl/injections.scm @@ -0,0 +1,6 @@ +([ + (lineComment) + (blockComment) + (docComment) +] @injection.content + (#set! injection.language "comment")) |
