From 016cba16a07b582414d3174a58dd38d2d6b20e49 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Mon, 19 Jun 2023 21:18:42 +0800 Subject: [PATCH] feat: add groovy support --- lua/nvim-treesitter/parsers.lua | 9 ++++++ queries/groovy/highlights.scm | 51 +++++++++++++++++++++++++++++++++ queries/groovy/injections.scm | 1 + 3 files changed, 61 insertions(+) create mode 100644 queries/groovy/highlights.scm create mode 100644 queries/groovy/injections.scm diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 028273e58..deb542a5b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -603,6 +603,15 @@ list.gowork = { maintainers = { "@omertuc" }, } +list.groovy = { + install_info = { + url = "https://github.com/Decodetalkers/tree-sitter-groovy", + files = { "src/parser.c" }, + branch = "gh-pages", + }, + maintainers = { "@Decodetalkers" }, +} + list.graphql = { install_info = { url = "https://github.com/bkegley/tree-sitter-graphql", diff --git a/queries/groovy/highlights.scm b/queries/groovy/highlights.scm new file mode 100644 index 000000000..2f9f541b8 --- /dev/null +++ b/queries/groovy/highlights.scm @@ -0,0 +1,51 @@ +(unit + (identifier) @variable) +(string + (identifier) @variable) + +(escape_sequence) @string.escape + +(block + (unit + (identifier) @namespace)) + +(func + (identifier) @function) + +(number) @number + +((identifier) @boolean + (#any-of? @boolean "true" "false" "True" "False")) + +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + +((identifier) @type.definition + (#any-of? @type.definition + "string" + "String" + "void" + "id" + "version" + "apply" + "implementation" + "testImplementation" + "androidTestImplementation" + "debugImplementation")) + +((identifier) @keyword + (#any-of? @keyword + "static" + "class" + "def" + "import" + "new")) + +(string) @string + +(comment) @comment + +(operators) @operator +(leading_key) @operator + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket diff --git a/queries/groovy/injections.scm b/queries/groovy/injections.scm new file mode 100644 index 000000000..4bb7d675d --- /dev/null +++ b/queries/groovy/injections.scm @@ -0,0 +1 @@ +(comment) @comment