From a05979b623b5017043c20e17ba949fb279d0eb60 Mon Sep 17 00:00:00 2001 From: Ankit Goel Date: Thu, 8 Feb 2024 00:46:19 +0000 Subject: [PATCH] feat(toml): Add @parameter.inner and @parameter.outer (#561) Includes array elements, key-val pair in inline tables and key-val pairs in normal tables. --- queries/toml/textobjects.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/queries/toml/textobjects.scm b/queries/toml/textobjects.scm index d1d74e6d..bd5e06df 100644 --- a/queries/toml/textobjects.scm +++ b/queries/toml/textobjects.scm @@ -2,3 +2,31 @@ (integer) (float) ] @number.inner + +((table + (pair) @parameter.inner @parameter.outer + )) + +((inline_table + "," @_start . + (_) @parameter.inner + ) + (#make-range! "parameter.outer" @_start @parameter.inner)) + +((inline_table + . (_) @parameter.inner + . ","? @_end + ) + (#make-range! "parameter.outer" @parameter.inner @_end)) + +((array + "," @_start . + (_) @parameter.inner + ) + (#make-range! "parameter.outer" @_start @parameter.inner)) + +((array + . (_) @parameter.inner + . ","? @_end + ) + (#make-range! "parameter.outer" @parameter.inner @_end))