Skip to content

Commit

Permalink
Handle comments in table_constructor in lua @parameter queries
Browse files Browse the repository at this point in the history
  • Loading branch information
qstrahl committed Jan 16, 2024
1 parent 19a91a3 commit 5b3df8b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions queries/lua/textobjects.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 5b3df8b

Please sign in to comment.