From 5b3df8b9a77726705f0097befd65b067eaede6eb Mon Sep 17 00:00:00 2001 From: Quinn Strahl Date: Mon, 8 Jan 2024 11:29:09 -0500 Subject: [PATCH] Handle comments in `table_constructor` in lua `@parameter` queries --- queries/lua/textobjects.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/queries/lua/textobjects.scm b/queries/lua/textobjects.scm index 1c1ca1d6..aa2c5554 100644 --- a/queries/lua/textobjects.scm +++ b/queries/lua/textobjects.scm @@ -76,9 +76,13 @@ (#make-range! "parameter.outer" @parameter.inner @_end)) (table_constructor - (field) @parameter.inner - ","? @_end - (#make-range! "parameter.outer" @parameter.inner @_end)) + . (field) @parameter.inner . ","? @_outer_end + (#make-range! "parameter.outer" @parameter.inner @_outer_end)) + +(table_constructor + . (_) @_start . (_)* @_inner_end . ","? @_outer_end + (#make-range! "parameter.inner" @_start @_inner_end) + (#make-range! "parameter.outer" @_start @_outer_end)) (arguments "," @_start @@ -90,6 +94,15 @@ . (_) @parameter.inner (#make-range! "parameter.outer" @_start @parameter.inner)) +(table_constructor + "," @_outer_start . (field) @parameter.inner . ","? + (#make-range! "parameter.outer" @_outer_start @parameter.inner)) + +(table_constructor + "," @_outer_start . (_) @_inner_start . (_)* @_end . ","? + (#make-range! "parameter.inner" @_inner_start @_end) + (#make-range! "parameter.outer" @_outer_start @_end)) + ; number (number) @number.inner