From 9bfb0caf1b4bafdac8eb964f38f7820740056fff Mon Sep 17 00:00:00 2001 From: Daniel S Poulin Date: Sun, 6 Mar 2022 00:24:24 -0500 Subject: Add comment textobject for surround selection and navigation (#1605) --- runtime/queries/c/textobjects.scm | 4 ++++ runtime/queries/cmake/textobjects.scm | 9 +++++++++ runtime/queries/fish/textobjects.scm | 4 ++++ runtime/queries/go/textobjects.scm | 4 ++++ runtime/queries/llvm-mir/textobjects.scm | 9 +++++++++ runtime/queries/llvm/textobjects.scm | 4 ++++ runtime/queries/perl/textobjects.scm | 9 +++++++++ runtime/queries/php/textobjects.scm | 4 ++++ runtime/queries/python/textobjects.scm | 4 ++++ runtime/queries/rescript/textobjects.scm | 7 +++++++ runtime/queries/rust/textobjects.scm | 9 +++++++++ runtime/queries/tablegen/textobjects.scm | 9 +++++++++ 12 files changed, 76 insertions(+) (limited to 'runtime') diff --git a/runtime/queries/c/textobjects.scm b/runtime/queries/c/textobjects.scm index b0f03668..45f554e2 100644 --- a/runtime/queries/c/textobjects.scm +++ b/runtime/queries/c/textobjects.scm @@ -11,3 +11,7 @@ body: (_) @class.inside) @class.around (parameter_declaration) @parameter.inside + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/cmake/textobjects.scm b/runtime/queries/cmake/textobjects.scm index b0d1b108..1fa9ded5 100644 --- a/runtime/queries/cmake/textobjects.scm +++ b/runtime/queries/cmake/textobjects.scm @@ -1,3 +1,12 @@ (macro_def) @function.around (argument) @parameter.inside + +[ + (bracket_comment) + (line_comment) +] @comment.inside + +(line_comment)+ @comment.around + +(bracket_comment) @comment.around \ No newline at end of file diff --git a/runtime/queries/fish/textobjects.scm b/runtime/queries/fish/textobjects.scm index 67fd6614..de8caa96 100644 --- a/runtime/queries/fish/textobjects.scm +++ b/runtime/queries/fish/textobjects.scm @@ -1 +1,5 @@ (function_definition) @function.around + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/go/textobjects.scm b/runtime/queries/go/textobjects.scm index 9bcfc690..d77e14b7 100644 --- a/runtime/queries/go/textobjects.scm +++ b/runtime/queries/go/textobjects.scm @@ -19,3 +19,7 @@ (argument_list (_) @parameter.inside) + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/llvm-mir/textobjects.scm b/runtime/queries/llvm-mir/textobjects.scm index 73f6f772..003ce594 100644 --- a/runtime/queries/llvm-mir/textobjects.scm +++ b/runtime/queries/llvm-mir/textobjects.scm @@ -1,3 +1,12 @@ (basic_block) @function.around (argument) @parameter.inside + +[ + (comment) + (multiline_comment) +] @comment.inside + +(comment)+ @comment.around + +(multiline_comment) @comment.around diff --git a/runtime/queries/llvm/textobjects.scm b/runtime/queries/llvm/textobjects.scm index 3738a3bb..dd15dc14 100644 --- a/runtime/queries/llvm/textobjects.scm +++ b/runtime/queries/llvm/textobjects.scm @@ -14,3 +14,7 @@ (array_vector_body) @class.inside) @class.around (argument) @parameter.inside + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/perl/textobjects.scm b/runtime/queries/perl/textobjects.scm index 988e22b4..972b8774 100644 --- a/runtime/queries/perl/textobjects.scm +++ b/runtime/queries/perl/textobjects.scm @@ -6,3 +6,12 @@ (argument (_) @parameter.inside) + +[ + (comments) + (pod_statement) +] @comment.inside + +(comments)+ @comment.around + +(pod_statement) @comment.around diff --git a/runtime/queries/php/textobjects.scm b/runtime/queries/php/textobjects.scm index 04ffefd2..51abe5c7 100644 --- a/runtime/queries/php/textobjects.scm +++ b/runtime/queries/php/textobjects.scm @@ -28,3 +28,7 @@ (variadic_parameter) (property_promotion_parameter) ] @parameter.inside) + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/python/textobjects.scm b/runtime/queries/python/textobjects.scm index a52538af..0ca26089 100644 --- a/runtime/queries/python/textobjects.scm +++ b/runtime/queries/python/textobjects.scm @@ -12,3 +12,7 @@ (argument_list (_) @parameter.inside) + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/rescript/textobjects.scm b/runtime/queries/rescript/textobjects.scm index 7ee8cd1a..fa1c4ff0 100644 --- a/runtime/queries/rescript/textobjects.scm +++ b/runtime/queries/rescript/textobjects.scm @@ -7,3 +7,10 @@ ;---------- (function body: (_) @function.inside) @function.around + +; Comments +;--------- + +(comment) @comment.inside + +(comment)+ @comment.around diff --git a/runtime/queries/rust/textobjects.scm b/runtime/queries/rust/textobjects.scm index e3132687..086db67a 100644 --- a/runtime/queries/rust/textobjects.scm +++ b/runtime/queries/rust/textobjects.scm @@ -24,3 +24,12 @@ (arguments (_) @parameter.inside) + +[ + (line_comment) + (block_comment) +] @comment.inside + +(line_comment)+ @comment.around + +(block_comment) @comment.around diff --git a/runtime/queries/tablegen/textobjects.scm b/runtime/queries/tablegen/textobjects.scm index 2cb80268..89645b34 100644 --- a/runtime/queries/tablegen/textobjects.scm +++ b/runtime/queries/tablegen/textobjects.scm @@ -5,3 +5,12 @@ body: (_) @class.inside) @class.around (_ argument: _ @parameter.inside) + +[ + (comment) + (multiline_comment) +] @comment.inside + +(comment)+ @comment.around + +(multiline_comment) @comment.around -- cgit v1.2.3-70-g09d2