From 4cf847f966e380aeac2349663aebcf17ef7a15fa Mon Sep 17 00:00:00 2001 From: Corey McCourt Date: Tue, 12 Nov 2024 17:56:34 -0800 Subject: [PATCH 1/3] feat(gleam): support function and parameter --- queries/gleam/textobjects.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 queries/gleam/textobjects.scm diff --git a/queries/gleam/textobjects.scm b/queries/gleam/textobjects.scm new file mode 100644 index 00000000..c9143d96 --- /dev/null +++ b/queries/gleam/textobjects.scm @@ -0,0 +1,25 @@ +; function +(function + body: (_) @function.inner) @function.outer + +(function_type + (_)) @function.outer + +; parameter +(function_parameters + (_) @parameter.inner + . + ","? @_end + (#make-range! "parameter.outer" @parameter.inner @_end)) + +(arguments + (_) @parameter.inner + . + ","? @_end + (#make-range! "parameter.outer" @parameter.inner @_end)) + +(data_constructor_arguments + (_) @parameter.inner + . + ","? @_end + (#make-range! "parameter.outer" @parameter.inner @_end)) From 7e34fa2aaf0fa6d2d84c716dd433ac90135c54b5 Mon Sep 17 00:00:00 2001 From: Corey McCourt Date: Tue, 12 Nov 2024 18:16:49 -0800 Subject: [PATCH 2/3] chore(gleam): support anonymous_function --- queries/gleam/textobjects.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queries/gleam/textobjects.scm b/queries/gleam/textobjects.scm index c9143d96..c27795f8 100644 --- a/queries/gleam/textobjects.scm +++ b/queries/gleam/textobjects.scm @@ -2,8 +2,8 @@ (function body: (_) @function.inner) @function.outer -(function_type - (_)) @function.outer +(anonymous_function + body: (_) @function.inner) @function.outer ; parameter (function_parameters From 73367db215e12aa9a4f4c78cb52b270c6eec65a6 Mon Sep 17 00:00:00 2001 From: Corey McCourt Date: Tue, 12 Nov 2024 19:20:47 -0800 Subject: [PATCH 3/3] chore(gleam): capture comma for last parameter --- queries/gleam/textobjects.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/queries/gleam/textobjects.scm b/queries/gleam/textobjects.scm index c27795f8..af4caf00 100644 --- a/queries/gleam/textobjects.scm +++ b/queries/gleam/textobjects.scm @@ -7,19 +7,40 @@ ; parameter (function_parameters + . (_) @parameter.inner . ","? @_end (#make-range! "parameter.outer" @parameter.inner @_end)) +(function_parameters + "," @_start + . + (_) @parameter.inner + (#make-range! "parameter.outer" @_start @parameter.inner)) + (arguments + . (_) @parameter.inner . ","? @_end (#make-range! "parameter.outer" @parameter.inner @_end)) +(arguments + "," @_start + . + (_) @parameter.inner + (#make-range! "parameter.outer" @_start @parameter.inner)) + (data_constructor_arguments + . (_) @parameter.inner . ","? @_end (#make-range! "parameter.outer" @parameter.inner @_end)) + +(data_constructor_arguments + "," @_start + . + (_) @parameter.inner + (#make-range! "parameter.outer" @_start @parameter.inner))