From c195c02c3bd2b5498d7f6ad0085ec92cb0c53499 Mon Sep 17 00:00:00 2001 From: Katinka Tauber Date: Thu, 9 Nov 2023 15:26:02 +0100 Subject: [PATCH 1/2] Add extension snippets for all do binds. See #302 --- metafix-vsc/fix.snippets.json | 23 +++++++++++++++++++---- metafix-vsc/package.json | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/metafix-vsc/fix.snippets.json b/metafix-vsc/fix.snippets.json index 6ac945a45..19da0c4cb 100644 --- a/metafix-vsc/fix.snippets.json +++ b/metafix-vsc/fix.snippets.json @@ -1,7 +1,22 @@ { - "do bind": { - "prefix": ["do"], - "body": ["do ${1:collector}(${2:args})", "\t${0:body}", "end"], - "description": "A do bind changes the execution context of the body functions. They are executed for each element in the list." + "do list": { + "prefix": ["do list"], + "body": ["do list(path: \"${1:}\", \"var\": \"${4:}\")", "\t${0:body}", "end"], + "description": "Iterates over each element of an array. In contrast to Catmandu, it can also iterate over a single object or string." + }, + "do list_as": { + "prefix": ["do list_as"], + "body": ["do list_as(\"${1:}\", \"${2:}\")", "\t${0:body}", "end"], + "description": "Iterates over each named element of an array (like do list with a variable name). If multiple arrays are given, iterates over the corresponding elements from each array (i.e., all elements with the same array index, skipping elements whose arrays have already been exhausted)." + }, + "do once": { + "prefix": ["do once"], + "body": ["do once(\"${1:}\")", "\t${0:body}", "end"], + "description": "Executes the statements only once (when the bind is first encountered), not repeatedly for each record." + }, + "do put_macro": { + "prefix": ["do put_macro"], + "body": ["do put_macro(\"${1:}\")", "\t${0:body}", "end"], + "description": "Defines a named macro, i.e. a list of statements that can be executed later with the call_macro function." } } diff --git a/metafix-vsc/package.json b/metafix-vsc/package.json index 1c6a32cdc..58e278549 100644 --- a/metafix-vsc/package.json +++ b/metafix-vsc/package.json @@ -2,7 +2,7 @@ "name": "fix", "displayName": "fix", "description": "Language Support for Metafacture Fix (Xtext Language Server for Metafacture Fix). For more information, visit https://metafacture.org", - "version": "0.2.1", + "version": "0.3.0", "publisher": "metafacture", "license": "Apache-2.0", "engines": { From 8fb3ebc283f25b787b0c776dc2dc7efcf73f100f Mon Sep 17 00:00:00 2001 From: Katinka Tauber <72247962+katauber@users.noreply.github.com> Date: Fri, 10 Nov 2023 13:32:38 +0100 Subject: [PATCH 2/2] Replace "," with ":" in extension snippet Co-authored-by: Jens Wille --- metafix-vsc/fix.snippets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metafix-vsc/fix.snippets.json b/metafix-vsc/fix.snippets.json index 19da0c4cb..1c488d5f1 100644 --- a/metafix-vsc/fix.snippets.json +++ b/metafix-vsc/fix.snippets.json @@ -6,7 +6,7 @@ }, "do list_as": { "prefix": ["do list_as"], - "body": ["do list_as(\"${1:}\", \"${2:}\")", "\t${0:body}", "end"], + "body": ["do list_as(\"${1:}\": \"${2:}\")", "\t${0:body}", "end"], "description": "Iterates over each named element of an array (like do list with a variable name). If multiple arrays are given, iterates over the corresponding elements from each array (i.e., all elements with the same array index, skipping elements whose arrays have already been exhausted)." }, "do once": {