aboutsummaryrefslogtreecommitdiffstats
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
parentAdd workflow for checking query files (diff)
downloadnvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar.gz
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar.bz2
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar.lz
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar.xz
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.tar.zst
nvim-treesitter-69cabc69be49bc37c8a9bbb7def1415504b489b2.zip
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 000000000..7b59d5123
--- /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 000000000..4c030df7c
--- /dev/null
+++ b/queries/python/textobjects.scm
@@ -0,0 +1,3 @@
+
+(function_definition
+ body: (block)? @function.inner) @function.outer