diff --git a/README.md b/README.md index e8dc130..2f04d60 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ In addition, you will need to have either Treesitter or a working LSP client. Yo - dart - elixir - go +- groovy - help - html - java diff --git a/queries/groovy/aerial.scm b/queries/groovy/aerial.scm new file mode 100644 index 0000000..506c1d5 --- /dev/null +++ b/queries/groovy/aerial.scm @@ -0,0 +1,22 @@ +(juxt_function_call + function: (identifier) @name (#not-any-of? @name "else" "try" "exec") + (argument_list (closure)) + (#set! "kind" "Module") +) @symbol + +(declaration + name: (identifier) @name + (closure) + (#set! "kind" "Function") +) @symbol + +(juxt_function_call + function: (identifier) @keyword (#eq? @keyword "task") + (argument_list ((function_call function: (identifier) @name))) + (#set! "kind" "Function") +) @symbol + +(declaration + name: (identifier) @name + (#set! "kind" "Constant") + ) @symbol diff --git a/tests/symbols/groovy_test.json b/tests/symbols/groovy_test.json new file mode 100644 index 0000000..ac9d4e2 --- /dev/null +++ b/tests/symbols/groovy_test.json @@ -0,0 +1,124 @@ +[ + { + "col": 0, + "end_col": 41, + "end_lnum": 4, + "kind": "Constant", + "level": 0, + "lnum": 4, + "name": "enableProguardInReleaseBuilds", + "selection_range": { + "col": 4, + "end_col": 33, + "end_lnum": 4, + "lnum": 4 + } + }, + { + "col": 0, + "end_col": 1, + "end_lnum": 8, + "kind": "Module", + "level": 0, + "lnum": 6, + "name": "plugins", + "selection_range": { + "col": 0, + "end_col": 7, + "end_lnum": 6, + "lnum": 6 + } + }, + { + "col": 0, + "end_col": 27, + "end_lnum": 10, + "kind": "Constant", + "level": 0, + "lnum": 10, + "name": "magicNumber", + "selection_range": { + "col": 4, + "end_col": 15, + "end_lnum": 10, + "lnum": 10 + } + }, + { + "children": [ + { + "col": 4, + "end_col": 5, + "end_lnum": 19, + "kind": "Module", + "level": 1, + "lnum": 16, + "name": "compileOptions", + "selection_range": { + "col": 4, + "end_col": 18, + "end_lnum": 16, + "lnum": 16 + } + } + ], + "col": 0, + "end_col": 1, + "end_lnum": 20, + "kind": "Module", + "level": 0, + "lnum": 12, + "name": "android", + "selection_range": { + "col": 0, + "end_col": 7, + "end_lnum": 12, + "lnum": 12 + } + }, + { + "col": 0, + "end_col": 1, + "end_lnum": 26, + "kind": "Module", + "level": 0, + "lnum": 22, + "name": "dependencies", + "selection_range": { + "col": 0, + "end_col": 12, + "end_lnum": 22, + "lnum": 22 + } + }, + { + "col": 0, + "end_col": 12, + "end_lnum": 28, + "kind": "Constant", + "level": 0, + "lnum": 28, + "name": "welcome", + "selection_range": { + "col": 5, + "end_col": 12, + "end_lnum": 28, + "lnum": 28 + } + }, + { + "col": 4, + "end_col": 5, + "end_lnum": 31, + "kind": "Module", + "level": 0, + "lnum": 29, + "name": "doLast", + "selection_range": { + "col": 4, + "end_col": 10, + "end_lnum": 29, + "lnum": 29 + } + } +] diff --git a/tests/treesitter/groovy_test.gradle b/tests/treesitter/groovy_test.gradle new file mode 100644 index 0000000..5b8f2aa --- /dev/null +++ b/tests/treesitter/groovy_test.gradle @@ -0,0 +1,32 @@ +/** + * Run Proguard to shrink the Java bytecode in release builds. + */ +def enableProguardInReleaseBuilds = false + +plugins { + id 'com.android.application' +} + +def magicNumber = { -> 42 } + +android { + + compileSdkVersion rootProject.ext.compileSdkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation project(":lib") + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation fileTree(dir: 'libs', include: ['*.jar']) +} + +task welcome { + doLast { + println 'Welcome' + } +}