This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new b837139a640 kie-issues#904: Implement DMN 1.5 new FEEL functions 
support (list replace) in the new DMN Editor (#2141)
b837139a640 is described below

commit b837139a6404a9708499bda0d1a0197cdeb9c417
Author: Yeser Amer <[email protected]>
AuthorDate: Fri Feb 2 20:09:27 2024 +0100

    kie-issues#904: Implement DMN 1.5 new FEEL functions support (list replace) 
in the new DMN Editor (#2141)
---
 .../src/parser/ReservedWords.ts                    |  1 +
 packages/feel-input-component/src/FeelConfigs.ts   | 35 ++++++++++++++++++----
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts 
b/packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts
index 3f9b7725251..90d58c99bbf 100644
--- a/packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts
+++ b/packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts
@@ -80,6 +80,7 @@ export class ReservedWords {
     "invoke",
     "is",
     "list contains",
+    "list replace",
     "log",
     "lower case",
     "matches",
diff --git a/packages/feel-input-component/src/FeelConfigs.ts 
b/packages/feel-input-component/src/FeelConfigs.ts
index 0b9b64fe579..1462d70afe0 100644
--- a/packages/feel-input-component/src/FeelConfigs.ts
+++ b/packages/feel-input-component/src/FeelConfigs.ts
@@ -346,7 +346,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         examples: ["context merge( [{x:1}, {y:2}] ) = {x:1, y:2}", "context 
merge( [{x:1, y:0}, {y:2}] ) = {x:1, y:2}"],
       },
       {
-        label: "context put(context,key,value)",
+        label: "context put(context, key, value)",
         insertText: "context put($1, $2, $3)",
         description:
           "Returns a new `context` that includes the new entry, or overrides 
the existing value if an entry for the same key already exists in the supplied 
`context` parameter. A new entry is added as the last entry of the new context. 
If overriding an existing entry, the order of the keys maintains the same order 
as in the original context.",
@@ -362,7 +362,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         ],
       },
       {
-        label: "context put(context,keys,value)",
+        label: "context put(context, keys, value)",
         insertText: "context put($1, $2, $3)",
         description:
           "Returns the composite of nested invocations to `context put()` for 
each item in keys hierarchy in `context`.",
@@ -776,6 +776,29 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         ],
         examples: ["list contains( [1,2,3], 2 ) = true"],
       },
+      {
+        label: "list replace(list, position, newItem)",
+        insertText: "list replace($1, $2, $3)",
+        description: "Returns new list with `newItem` replaced at `position`.",
+        parameters: [
+          ["list", `\`list\``],
+          ["position", `\`number\``],
+          ["newItem", `Any type`],
+        ],
+        examples: ["list replace( [2, 4, 7, 8], 3, 6) = [2, 4, 6, 8]"],
+      },
+      {
+        label: "list replace(list, match, newItem)",
+        insertText: "list replace($1, $2, $3)",
+        description:
+          "Returns new list with `newItem` replaced at all positions where the 
`match` function returned `true`",
+        parameters: [
+          ["list", `\`list\``],
+          ["match", `boolean function(item, newItem)`],
+          ["newItem", `Any type`],
+        ],
+        examples: ["list replace( [2, 4, 7, 8], function(item, newItem) item < 
newItem, 5) = [5, 5, 7, 8]"],
+      },
       {
         label: "log(number)",
         insertText: "log($1)",
@@ -1185,7 +1208,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         examples: ["reverse( [1,2,3] ) = [3,2,1]"],
       },
       {
-        label: "round down(n,scale)",
+        label: "round down(n, scale)",
         insertText: "round down($1, $2)",
         description:
           "Returns `n` with given `scale` and rounding mode round down. If at 
least one of `n` or `scale` is null, the result is null.",
@@ -1201,7 +1224,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         ],
       },
       {
-        label: "round half down(n,scale)",
+        label: "round half down(n, scale)",
         insertText: "round half down($1, $2)",
         description:
           "Returns `n` with given `scale` and rounding mode round half down. 
If at least one of `n` or `scale` is null, the result is null.",
@@ -1217,7 +1240,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         ],
       },
       {
-        label: "round half up(n,scale)",
+        label: "round half up(n, scale)",
         insertText: "round half up($1, $2)",
         description:
           "Returns `n` with given `scale` and rounding mode round half up. If 
at least one of `n` or `scale` is null, the result is null.",
@@ -1233,7 +1256,7 @@ export const feelDefaultSuggestions = (): 
Monaco.languages.CompletionItem[] => {
         ],
       },
       {
-        label: "round up(n,scale)",
+        label: "round up(n, scale)",
         insertText: "round up($1, $2)",
         description:
           "Returns `n` with given `scale` and rounding mode round up. If at 
least one of `n` or `scale` is null, the result is null.",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to