diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 4f1191b33..0df25dc90 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -184,6 +184,7 @@ | powershell | ✓ | | | | | prisma | ✓ | ✓ | | `prisma-language-server` | | prolog | ✓ | | ✓ | `swipl` | +| properties | ✓ | ✓ | | | | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` | | prql | ✓ | | | | | pug | ✓ | | | | diff --git a/languages.toml b/languages.toml index 032fbc0b6..55584791b 100644 --- a/languages.toml +++ b/languages.toml @@ -4450,3 +4450,14 @@ auto-format = true [[grammar]] name = "caddyfile" source = { git = "https://github.com/caddyserver/tree-sitter-caddyfile", rev = "b04bdb4ec53e40c44afbf001e15540f60a296aef" } + +[[language]] +name = "properties" +scope = "source.properties" +injection-regex = "properties" +file-types = ["properties", "prefs"] +comment-tokens = ["#"] + +[[grammar]] +name = "properties" +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-properties", rev = "579b62f5ad8d96c2bb331f07d1408c92767531d9" } diff --git a/runtime/queries/properties/highlights.scm b/runtime/queries/properties/highlights.scm new file mode 100644 index 000000000..d3c6ed799 --- /dev/null +++ b/runtime/queries/properties/highlights.scm @@ -0,0 +1,40 @@ +(comment) @comment + +(key) @attribute + +(value) @string + +(value (escape) @constant.character.escape) + +((index) @constant.numeric.integer + (#match? @constant.numeric.integer "^[0-9]+$")) + +((substitution (key) @constant) + (#match? @constant "^[A-Z0-9_]+")) + +((value) @constant.builtin.boolean + (#any-of? @constant.builtin.boolean "true" "false" "enabled" "disabled")) + +((value) @constant.numeric.integer + (#match? @constant.numeric.integer "^-?[0-9]+$")) + +((value) @constant.numeric.float + (#match? @constant.numeric.float "^-?[0-9]+\.[0-9]$")) + +((value) @string.special.path + (#match? @string.special.path "^(\.{1,2})?/")) + +(substitution + (key) @function + "::" @punctuation.special + (secret) @string.special.symbol) + +(property [ "=" ":" ] @keyword.operator) + +[ "${" "}" ] @punctuation.special + +(substitution ":" @punctuation.special) + +[ "[" "]" ] @punctuation.bracket + +[ "." "\\" ] @punctuation.delimiter diff --git a/runtime/queries/properties/injections.scm b/runtime/queries/properties/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/runtime/queries/properties/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/properties/locals.scm b/runtime/queries/properties/locals.scm new file mode 100644 index 000000000..7a07220d4 --- /dev/null +++ b/runtime/queries/properties/locals.scm @@ -0,0 +1,5 @@ +(property + (key) @local.definition.attribute) + +(substitution + (key) @local.reference) diff --git a/runtime/queries/properties/textobjects.scm b/runtime/queries/properties/textobjects.scm new file mode 100644 index 000000000..9be538aca --- /dev/null +++ b/runtime/queries/properties/textobjects.scm @@ -0,0 +1,4 @@ +(comment) @comment.inside +(comment)+ @comment.around + +(property (key) @parameter.inside) @parameter.around