diff options
author | Erasin | 2022-07-28 13:31:20 +0000 |
---|---|---|
committer | GitHub | 2022-07-28 13:31:20 +0000 |
commit | 681c0a91dc36f9db1d23bd31ac1b66414d2a6099 (patch) | |
tree | 669807915b43ba0e6ce95ae4cdef101cb1debd1c | |
parent | cca83af3fdd24f997f459d5c9bc10833f530e8dc (diff) |
Add textobject for javascript (#3213)
-rw-r--r-- | book/src/generated/lang-support.md | 8 | ||||
-rw-r--r-- | runtime/queries/javascript/textobjects.scm | 36 | ||||
-rw-r--r-- | runtime/queries/jsx/textobjects.scm | 1 | ||||
-rw-r--r-- | runtime/queries/tsx/indents.scm | 1 | ||||
-rw-r--r-- | runtime/queries/tsx/textobjects.scm | 1 | ||||
-rw-r--r-- | runtime/queries/typescript/textobjects.scm | 8 |
6 files changed, 51 insertions, 4 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 4e8d82ec..0e150a67 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -45,10 +45,10 @@ | idris | | | | `idris2-lsp` | | iex | ✓ | | | | | java | ✓ | | | `jdtls` | -| javascript | ✓ | | ✓ | `typescript-language-server` | +| javascript | ✓ | ✓ | ✓ | `typescript-language-server` | | jsdoc | ✓ | | | | | json | ✓ | | ✓ | `vscode-json-language-server` | -| jsx | ✓ | | ✓ | `typescript-language-server` | +| jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | | | `julia` | | kotlin | ✓ | | | `kotlin-language-server` | | latex | ✓ | | | `texlab` | @@ -97,9 +97,9 @@ | tfvars | | | | `terraform-ls` | | toml | ✓ | | | `taplo` | | tsq | ✓ | | | | -| tsx | ✓ | | | `typescript-language-server` | +| tsx | ✓ | ✓ | ✓ | `typescript-language-server` | | twig | ✓ | | | | -| typescript | ✓ | | ✓ | `typescript-language-server` | +| typescript | ✓ | ✓ | ✓ | `typescript-language-server` | | ungrammar | ✓ | | | | | v | ✓ | | | `vls` | | vala | ✓ | | | `vala-language-server` | diff --git a/runtime/queries/javascript/textobjects.scm b/runtime/queries/javascript/textobjects.scm new file mode 100644 index 00000000..c80dc81b --- /dev/null +++ b/runtime/queries/javascript/textobjects.scm @@ -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 diff --git a/runtime/queries/jsx/textobjects.scm b/runtime/queries/jsx/textobjects.scm new file mode 100644 index 00000000..ff0ddfac --- /dev/null +++ b/runtime/queries/jsx/textobjects.scm @@ -0,0 +1 @@ +; inherits: javascript diff --git a/runtime/queries/tsx/indents.scm b/runtime/queries/tsx/indents.scm new file mode 100644 index 00000000..1b61e36d --- /dev/null +++ b/runtime/queries/tsx/indents.scm @@ -0,0 +1 @@ +; inherits: typescript diff --git a/runtime/queries/tsx/textobjects.scm b/runtime/queries/tsx/textobjects.scm new file mode 100644 index 00000000..07391231 --- /dev/null +++ b/runtime/queries/tsx/textobjects.scm @@ -0,0 +1 @@ +; inherits: typescript,jsx diff --git a/runtime/queries/typescript/textobjects.scm b/runtime/queries/typescript/textobjects.scm new file mode 100644 index 00000000..8564236b --- /dev/null +++ b/runtime/queries/typescript/textobjects.scm @@ -0,0 +1,8 @@ +; inherits: javascript + +[ + (interface_declaration + body:(_) @class.inside) + (type_alias_declaration + value: (_) @class.inside) +] @class.around |