Add textobject for javascript (#3213)
This commit is contained in:
parent
cca83af3fd
commit
681c0a91dc
6 changed files with 51 additions and 4 deletions
|
@ -45,10 +45,10 @@
|
||||||
| idris | | | | `idris2-lsp` |
|
| idris | | | | `idris2-lsp` |
|
||||||
| iex | ✓ | | | |
|
| iex | ✓ | | | |
|
||||||
| java | ✓ | | | `jdtls` |
|
| java | ✓ | | | `jdtls` |
|
||||||
| javascript | ✓ | | ✓ | `typescript-language-server` |
|
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||||
| jsdoc | ✓ | | | |
|
| jsdoc | ✓ | | | |
|
||||||
| json | ✓ | | ✓ | `vscode-json-language-server` |
|
| json | ✓ | | ✓ | `vscode-json-language-server` |
|
||||||
| jsx | ✓ | | ✓ | `typescript-language-server` |
|
| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||||
| julia | ✓ | | | `julia` |
|
| julia | ✓ | | | `julia` |
|
||||||
| kotlin | ✓ | | | `kotlin-language-server` |
|
| kotlin | ✓ | | | `kotlin-language-server` |
|
||||||
| latex | ✓ | | | `texlab` |
|
| latex | ✓ | | | `texlab` |
|
||||||
|
@ -97,9 +97,9 @@
|
||||||
| tfvars | | | | `terraform-ls` |
|
| tfvars | | | | `terraform-ls` |
|
||||||
| toml | ✓ | | | `taplo` |
|
| toml | ✓ | | | `taplo` |
|
||||||
| tsq | ✓ | | | |
|
| tsq | ✓ | | | |
|
||||||
| tsx | ✓ | | | `typescript-language-server` |
|
| tsx | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||||
| twig | ✓ | | | |
|
| twig | ✓ | | | |
|
||||||
| typescript | ✓ | | ✓ | `typescript-language-server` |
|
| typescript | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||||
| ungrammar | ✓ | | | |
|
| ungrammar | ✓ | | | |
|
||||||
| v | ✓ | | | `vls` |
|
| v | ✓ | | | `vls` |
|
||||||
| vala | ✓ | | | `vala-language-server` |
|
| vala | ✓ | | | `vala-language-server` |
|
||||||
|
|
36
runtime/queries/javascript/textobjects.scm
Normal file
36
runtime/queries/javascript/textobjects.scm
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
(function_declaration
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(function
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(arrow_function
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(method_definition
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(generator_function_declaration
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
body: (class_body) @class.inside) @class.around
|
||||||
|
|
||||||
|
(class
|
||||||
|
(class_body) @class.inside) @class.around
|
||||||
|
|
||||||
|
(export_statement
|
||||||
|
declaration: [
|
||||||
|
(function_declaration) @function.around
|
||||||
|
(class_declaration) @class.around
|
||||||
|
])
|
||||||
|
|
||||||
|
(formal_parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(arguments
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(comment) @comment.inside
|
||||||
|
|
||||||
|
(comment)+ @comment.around
|
1
runtime/queries/jsx/textobjects.scm
Normal file
1
runtime/queries/jsx/textobjects.scm
Normal file
|
@ -0,0 +1 @@
|
||||||
|
; inherits: javascript
|
1
runtime/queries/tsx/indents.scm
Normal file
1
runtime/queries/tsx/indents.scm
Normal file
|
@ -0,0 +1 @@
|
||||||
|
; inherits: typescript
|
1
runtime/queries/tsx/textobjects.scm
Normal file
1
runtime/queries/tsx/textobjects.scm
Normal file
|
@ -0,0 +1 @@
|
||||||
|
; inherits: typescript,jsx
|
8
runtime/queries/typescript/textobjects.scm
Normal file
8
runtime/queries/typescript/textobjects.scm
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
; inherits: javascript
|
||||||
|
|
||||||
|
[
|
||||||
|
(interface_declaration
|
||||||
|
body:(_) @class.inside)
|
||||||
|
(type_alias_declaration
|
||||||
|
value: (_) @class.inside)
|
||||||
|
] @class.around
|
Loading…
Add table
Reference in a new issue