aboutsummaryrefslogtreecommitdiffstats
path: root/queries/javascript/textobjects.scm
diff options
context:
space:
mode:
authorSteven Sojka <steelsojka@gmail.com>2020-07-22 08:42:49 -0500
committerStephan Seitz <stephan.lauf@yahoo.de>2020-07-22 23:41:57 +0200
commite821349661d6d88e412595df46b365581ff10b27 (patch)
treeb16a1c693606546c3e4b5b6e51f033a96d15f545 /queries/javascript/textobjects.scm
parentFix #198: prefer method highlighting over attribute (diff)
downloadnvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar.gz
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar.bz2
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar.lz
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar.xz
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.tar.zst
nvim-treesitter-e821349661d6d88e412595df46b365581ff10b27.zip
add js textobject queries
Diffstat (limited to 'queries/javascript/textobjects.scm')
-rw-r--r--queries/javascript/textobjects.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/queries/javascript/textobjects.scm b/queries/javascript/textobjects.scm
new file mode 100644
index 000000000..376cc3b15
--- /dev/null
+++ b/queries/javascript/textobjects.scm
@@ -0,0 +1,36 @@
+(function_declaration
+ body: (statement_block) @function.inner) @function.outer
+
+(export_statement
+ (function_declaration) @function.outer) @function.outer.start
+
+(arrow_function
+ body: (_) @function.inner) @function.outer
+
+(method_definition
+ body: (statement_block) @function.inner) @function.outer
+
+(class_declaration
+ body: (class_body) @class.inner) @class.outer
+
+(export_statement
+ (class_declaration) @class.outer) @class.outer.start
+
+(for_in_statement
+ body: (_)? @loop.inner) @loop.outer
+
+(while_statement
+ body: (_)? @loop.inner) @loop.outer
+
+(do_statement
+ body: (_)? @loop.inner) @loop.outer
+
+(if_statement
+ consequence: (_)? @conditional.inner
+ alternative: (_)? @conditional.inner) @conditional.outer
+
+(switch_statement
+ body: (_)? @conditional.inner) @conditional.outer
+
+(call_expression) @call.outer
+(call_expression (arguments) @call.inner)