diff options
| author | purarue <7804791+purarue@users.noreply.github.com> | 2025-09-14 08:53:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-14 10:53:21 +0200 |
| commit | 7aa24acae3a288e442e06928171f360bbdf75ba4 (patch) | |
| tree | e89fc98df4b46ed201e83f8495f61b88fb7b7e8b | |
| parent | feat(python)!: update parser and queries (diff) | |
| download | nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar.gz nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar.bz2 nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar.lz nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar.xz nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.tar.zst nvim-treesitter-7aa24acae3a288e442e06928171f360bbdf75ba4.zip | |
feat(rifleconf): add parser and queries
| -rw-r--r-- | SUPPORTED_LANGUAGES.md | 1 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | runtime/queries/rifleconf/highlights.scm | 31 | ||||
| -rw-r--r-- | runtime/queries/rifleconf/injections.scm | 16 |
4 files changed, 56 insertions, 0 deletions
diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 25c5e1137..361585ab2 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -244,6 +244,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [rego](https://github.com/FallenAngel97/tree-sitter-rego) | unstable | `H J ` | | @FallenAngel97 [requirements](https://github.com/tree-sitter-grammars/tree-sitter-requirements) | unstable | `H J ` | | @ObserverOfTime [rescript](https://github.com/rescript-lang/tree-sitter-rescript) | unstable | `HFIJL` | | @ribru17 +[rifleconf](https://github.com/purarue/tree-sitter-rifleconf) | unstable | `H J ` | | @purarue [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) | unstable | `HF J ` | | @bamonroe [robot](https://github.com/Hubro/tree-sitter-robot) | unstable | `HFIJ ` | | @Hubro [robots](https://github.com/opa-oz/tree-sitter-robots-txt) | unstable | `H J ` | | @opa-oz diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index f9f9620e4..096d93599 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1908,6 +1908,14 @@ return { maintainers = { '@ribru17' }, tier = 2, }, + rifleconf = { + install_info = { + url = 'https://github.com/purarue/tree-sitter-rifleconf', + revision = 'b215640ba72a9a8cac6f5d95dbc3d320cb546e13', + }, + maintainers = { '@purarue' }, + tier = 2, + }, rnoweb = { install_info = { revision = '1a74dc0ed731ad07db39f063e2c5a6fe528cae7f', diff --git a/runtime/queries/rifleconf/highlights.scm b/runtime/queries/rifleconf/highlights.scm new file mode 100644 index 000000000..2ac837a3e --- /dev/null +++ b/runtime/queries/rifleconf/highlights.scm @@ -0,0 +1,31 @@ +(comment) @comment @spell + +[ + "," + ";" +] @punctuation.delimiter + +[ + "=" + (condition_negation) +] @operator + +; mark the string values for items interpreted as regex as string.regexp +(binary_condition_expression + (binary_condition_identifier) @_keyword + (identifier) @string.regexp + (#any-of? @_keyword "match" "ext" "mime" "name" "path")) + +(binary_condition_identifier) @keyword + +(unary_condition_identifier) @keyword + +(condition_expression + (binary_condition_expression + (binary_condition_identifier) @keyword + (identifier) @number) + (#eq? @keyword "number")) + +(ask) @function.builtin + +(string) @string diff --git a/runtime/queries/rifleconf/injections.scm b/runtime/queries/rifleconf/injections.scm new file mode 100644 index 000000000..e0463982f --- /dev/null +++ b/runtime/queries/rifleconf/injections.scm @@ -0,0 +1,16 @@ +; These are all interpreted as regex when evaluated +; https://github.com/ranger/ranger/blob/38bb8901004b75a407ffee4b9e176bc0a436cb15/ranger/ext/rifle.py#L273-L282 +(binary_condition_expression + (binary_condition_identifier) @_keyword + (identifier) @injection.content + (#any-of? @_keyword "match" "ext" "mime" "name" "path") + (#set! injection.language "regex")) + +; highlight any commands using the bash tree-sitter parser +(command_list + (command) @injection.content + (#set! injection.include-children) + (#set! injection.language "bash")) + +((comment) @injection.content + (#set! injection.language "comment")) |
