summaryrefslogtreecommitdiff
path: root/queries
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-06-21 20:38:00 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-14 22:34:43 +0200
commit69cabc69be49bc37c8a9bbb7def1415504b489b2 (patch)
treecc4925d6ce00654c181a7cb4d2eef3dc488a324b /queries
parentc42c38a8346dd9edda96477b774d3e086cd73650 (diff)
Add textobjects module
Diffstat (limited to 'queries')
-rw-r--r--queries/c/textobjects.scm8
-rw-r--r--queries/python/textobjects.scm3
2 files changed, 11 insertions, 0 deletions
diff --git a/queries/c/textobjects.scm b/queries/c/textobjects.scm
new file mode 100644
index 00000000..7b59d512
--- /dev/null
+++ b/queries/c/textobjects.scm
@@ -0,0 +1,8 @@
+;; TODO: supported by official Tree-sitter if (_)* is more than one node
+;; Neovim: will only match if (_) is exactly one node
+;(function_definition
+ ;body: (compound_statement
+ ;("{" (_)* @function.inner "}"))?) @function.outer
+
+(function_definition
+ body: (compound_statement) @function.inner) @function.outer
diff --git a/queries/python/textobjects.scm b/queries/python/textobjects.scm
new file mode 100644
index 00000000..4c030df7
--- /dev/null
+++ b/queries/python/textobjects.scm
@@ -0,0 +1,3 @@
+
+(function_definition
+ body: (block)? @function.inner) @function.outer