From 4b32b544fc57c53e1406fa7705068f0222498019 Mon Sep 17 00:00:00 2001 From: Clara Hobbs Date: Thu, 6 Apr 2023 12:35:05 -0400 Subject: [PATCH] Add textobject queries for Julia (#6588) * Add textobjects queries for Julia * Update docs for Julia textobject queries --- book/src/generated/lang-support.md | 2 +- runtime/queries/julia/textobjects.scm | 46 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/julia/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index d71acc566..12cd2babf 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -69,7 +69,7 @@ | json | ✓ | | ✓ | `vscode-json-language-server` | | jsonnet | ✓ | | | `jsonnet-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | -| julia | ✓ | | ✓ | `julia` | +| julia | ✓ | ✓ | ✓ | `julia` | | kdl | ✓ | | | | | kotlin | ✓ | | | `kotlin-language-server` | | latex | ✓ | ✓ | | `texlab` | diff --git a/runtime/queries/julia/textobjects.scm b/runtime/queries/julia/textobjects.scm new file mode 100644 index 000000000..1927c2b18 --- /dev/null +++ b/runtime/queries/julia/textobjects.scm @@ -0,0 +1,46 @@ +(function_definition (_)? @function.inside) @function.around + +(short_function_definition (_)? @function.inside) @function.around + +(macro_definition (_)? @function.inside) @function.around + +(struct_definition (_)? @class.inside) @class.around + +(abstract_definition (_)? @class.inside) @class.around + +(primitive_definition (_)? @class.inside) @class.around + +(parameter_list + ; Match all children of parameter_list *except* keyword_parameters + ([(identifier) + (slurp_parameter) + (optional_parameter) + (typed_parameter) + (tuple_expression) + (interpolation_expression) + (call_expression)] + @parameter.inside . ","? @parameter.around) @parameter.around) + +(keyword_parameters + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(argument_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(type_parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(line_comment) @comment.inside + +(line_comment)+ @comment.around + +(block_comment) @comment.inside + +(block_comment)+ @comment.around + +(_expression (macro_identifier + (identifier) @_name + (#match? @_name "^(test|test_throws|test_logs|inferred|test_deprecated|test_warn|test_nowarn|test_broken|test_skip)$") + ) + . + (macro_argument_list) @test.inside) @test.around