on master help sign in
Add textobject for javascript (#3213)
commit681c0a91dc36f9db1d23bd31ac1b66414d2a6099 authorErasin <erasinoo@gmail.com> dateThu 28 Jul 2022, 21:31 (4 years ago) parentcca83af
6 files changed+51−4
book/src/generated/lang-support.md+4−4 runtime/queries/javascript/textobjects.scm+36 runtime/queries/jsx/textobjects.scm+1 runtime/queries/tsx/indents.scm+1 runtime/queries/tsx/textobjects.scm+1 runtime/queries/typescript/textobjects.scm+8
book/src/generated/lang-support.md+4−4
@@ -45,10 +45,10 @@
4545| idris | | | | `idris2-lsp` |
4646| iex | ✓ | | | |
4747| java | ✓ | | | `jdtls` |
48−| javascript | ✓ | | ✓ | `typescript-language-server` |
48+| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
4949| jsdoc | ✓ | | | |
5050| json | ✓ | | ✓ | `vscode-json-language-server` |
51−| jsx | ✓ | | ✓ | `typescript-language-server` |
51+| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
5252| julia | ✓ | | | `julia` |
5353| kotlin | ✓ | | | `kotlin-language-server` |
5454| latex | ✓ | | | `texlab` |
@@ -97,9 +97,9 @@
9797| tfvars | | | | `terraform-ls` |
9898| toml | ✓ | | | `taplo` |
9999| tsq | ✓ | | | |
100−| tsx | ✓ | | | `typescript-language-server` |
100+| tsx | ✓ | ✓ | ✓ | `typescript-language-server` |
101101| twig | ✓ | | | |
102−| typescript | ✓ | | ✓ | `typescript-language-server` |
102+| typescript | ✓ | ✓ | ✓ | `typescript-language-server` |
103103| ungrammar | ✓ | | | |
104104| v | ✓ | | | `vls` |
105105| vala | ✓ | | | `vala-language-server` |
runtime/queries/javascript/textobjects.scmnew file+36
@@ -0,0 +1,36 @@
1+(function_declaration
2+ body: (_) @function.inside) @function.around
3+
4+(function
5+ body: (_) @function.inside) @function.around
6+
7+(arrow_function
8+ body: (_) @function.inside) @function.around
9+
10+(method_definition
11+ body: (_) @function.inside) @function.around
12+
13+(generator_function_declaration
14+ body: (_) @function.inside) @function.around
15+
16+(class_declaration
17+ body: (class_body) @class.inside) @class.around
18+
19+(class
20+ (class_body) @class.inside) @class.around
21+
22+(export_statement
23+ declaration: [
24+ (function_declaration) @function.around
25+ (class_declaration) @class.around
26+ ])
27+
28+(formal_parameters
29+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
30+
31+(arguments
32+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
33+
34+(comment) @comment.inside
35+
36+(comment)+ @comment.around
runtime/queries/jsx/textobjects.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: javascript
runtime/queries/tsx/indents.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: typescript
runtime/queries/tsx/textobjects.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: typescript,jsx
runtime/queries/typescript/textobjects.scmnew file+8
@@ -0,0 +1,8 @@
1+; inherits: javascript
2+
3+[
4+ (interface_declaration
5+ body:(_) @class.inside)
6+ (type_alias_declaration
7+ value: (_) @class.inside)
8+] @class.around