Add textobject queries for Scala (#9191)
This commit is contained in:
parent
a32d537d0a
commit
73deba7044
2 changed files with 60 additions and 1 deletions
|
@ -145,7 +145,7 @@
|
||||||
| ruby | ✓ | ✓ | ✓ | `solargraph` |
|
| ruby | ✓ | ✓ | ✓ | `solargraph` |
|
||||||
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
|
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
|
||||||
| sage | ✓ | ✓ | | |
|
| sage | ✓ | ✓ | | |
|
||||||
| scala | ✓ | | ✓ | `metals` |
|
| scala | ✓ | ✓ | ✓ | `metals` |
|
||||||
| scheme | ✓ | | ✓ | |
|
| scheme | ✓ | | ✓ | |
|
||||||
| scss | ✓ | | | `vscode-css-language-server` |
|
| scss | ✓ | | | `vscode-css-language-server` |
|
||||||
| slint | ✓ | | ✓ | `slint-lsp` |
|
| slint | ✓ | | ✓ | `slint-lsp` |
|
||||||
|
|
59
runtime/queries/scala/textobjects.scm
Normal file
59
runtime/queries/scala/textobjects.scm
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
; Function queries
|
||||||
|
|
||||||
|
(function_definition
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
; Does not match block lambdas or Scala 3 braceless lambdas
|
||||||
|
(lambda_expression
|
||||||
|
(_) @function.inside) @function.around
|
||||||
|
|
||||||
|
|
||||||
|
; Class queries
|
||||||
|
|
||||||
|
(object_definition
|
||||||
|
body: (_)? @class.inside) @class.around
|
||||||
|
|
||||||
|
(class_definition
|
||||||
|
body: (_)? @class.inside) @class.around
|
||||||
|
|
||||||
|
(trait_definition
|
||||||
|
body: (_)? @class.inside) @class.around
|
||||||
|
|
||||||
|
(type_definition) @class.around
|
||||||
|
|
||||||
|
(enum_case_definitions) @class.around
|
||||||
|
|
||||||
|
(enum_definition
|
||||||
|
body: (_)? @class.inside) @class.around
|
||||||
|
|
||||||
|
|
||||||
|
; Parameter queries
|
||||||
|
|
||||||
|
(parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(parameter_types
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(bindings
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
; Does not match context bounds or higher-kinded types
|
||||||
|
(type_parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(arguments
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(type_arguments
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
|
||||||
|
; Comment queries
|
||||||
|
|
||||||
|
(comment) @comment.inside
|
||||||
|
(comment) @comment.around ; Does not match consecutive block comments
|
||||||
|
|
||||||
|
|
||||||
|
; Test queries
|
||||||
|
; Not supported
|
Loading…
Add table
Reference in a new issue