diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/ExpressionEditorContext.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/ExpressionEditorContext.java
index 0cb8cb8233..c9a68602e4 100644
--- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/ExpressionEditorContext.java
+++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/ExpressionEditorContext.java
@@ -207,6 +207,45 @@ public LineRange generateStatement() {
return statementLineRange;
}
+ /**
+ * Generates a Ballerina function definition with the provided signature, containing the statement
+ * generated by {@link #generateStatement()} as the function body.
+ *
+ *
+ * TODO: This is a temporary workaround to provide completions for the data mapper, and should be removed once
+ * the API extension is complete.
+ *
+ * @param functionSignature the function signature (e.g., "(Person person, Admission admission) returns Employee")
+ * @return the line range of the generated function definition
+ */
+ public LineRange generateFunctionDefinition(String functionSignature) {
+ // Get the text position of the start line
+ TextDocument textDocument = documentContext.document().textDocument();
+ LinePosition cursorStartLine = startLine();
+ int textPosition = textDocument.textPositionFrom(cursorStartLine);
+
+ // Build function header with opening brace and indentation
+ String functionHeader = String.format("function %s {%n ", functionSignature);
+
+ // Apply the function header
+ List textEdits = new ArrayList<>();
+ textEdits.add(TextEdit.from(TextRange.from(textPosition, 0), functionHeader));
+ applyTextEdits(textEdits);
+
+ // Calculate the number of lines added by the function header
+ int functionHeaderLines = functionHeader.split(System.lineSeparator()).length - 1;
+
+ // Update the start line to account for the function header
+ // Store original start line for later calculation
+ this.startLine = LinePosition.from(
+ cursorStartLine.line() + functionHeaderLines,
+ 4 // Indentation of 4 spaces
+ );
+
+ // Generate the statement inside the function body
+ return generateStatement();
+ }
+
public LineRange getExpressionLineRange() {
LinePosition startLine = info().startLine();
LinePosition endLine =
diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/services/CompletionRequest.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/services/CompletionRequest.java
index 8d5bde7b3a..fc5df4beae 100644
--- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/services/CompletionRequest.java
+++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/expressioneditor/services/CompletionRequest.java
@@ -18,8 +18,15 @@
package io.ballerina.flowmodelgenerator.core.expressioneditor.services;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import io.ballerina.compiler.syntax.tree.FunctionDefinitionNode;
+import io.ballerina.compiler.syntax.tree.NonTerminalNode;
import io.ballerina.flowmodelgenerator.core.expressioneditor.ExpressionEditorContext;
import io.ballerina.flowmodelgenerator.core.model.Property;
+import io.ballerina.tools.text.LineRange;
+import org.ballerinalang.langserver.common.utils.CommonUtil;
+import org.ballerinalang.langserver.common.utils.PositionUtil;
import org.eclipse.lsp4j.CompletionContext;
import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.CompletionItemKind;
@@ -45,6 +52,7 @@ public class CompletionRequest extends DebouncedExpressionEditorRequest, CompletionList> getResponse(ExpressionEditorContext context) {
- context.generateStatement();
+ String valueType = context.getProperty().valueType();
+
+ // TODO: Added a special case for expressions used within the data mapper, as inputs are not provided through
+ // the traditional method.
+ boolean generatedFunctionDefinition = false;
+ if (Property.ValueType.DATA_MAPPING_EXPRESSION.name().equals(valueType)) {
+ JsonElement lineRangeJson = context.info().codedata().get("lineRange");
+ LineRange lineRange = GSON.fromJson(lineRangeJson, LineRange.class);
+
+ if (lineRange != null) {
+ NonTerminalNode node = CommonUtil.findNode(PositionUtil.toRange(lineRange),
+ context.documentContext().document().syntaxTree());
+ if (node instanceof FunctionDefinitionNode functionDefinitionNode) {
+ context.generateFunctionDefinition(functionDefinitionNode.functionSignature().toString());
+ generatedFunctionDefinition = true;
+ }
+ }
+ }
+ if (!generatedFunctionDefinition) {
+ context.generateStatement();
+ }
+
Position position = context.getCursorPosition();
TextDocumentIdentifier identifier = new TextDocumentIdentifier(context.fileUri());
CompletionParams params = new CompletionParams(identifier, position, completionContext);
@@ -67,7 +96,6 @@ public Either, CompletionList> getResponse(ExpressionEditor
// Filter the completions if it is a lvexpr
// TODO: Extend the implementation to a different class
- String valueType = context.getProperty().valueType();
if (Property.ValueType.LV_EXPRESSION.name().equals(valueType)) {
List completionsList;
if (completions.getLeft() != null) {
diff --git a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java
index fd2ae319f8..fdf9459bec 100644
--- a/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java
+++ b/flow-model-generator/modules/flow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/model/Property.java
@@ -265,7 +265,8 @@ public enum ValueType {
FIXED_PROPERTY,
RAW_TEMPLATE,
REPEATABLE_PROPERTY,
- ACTION_PATH
+ ACTION_PATH,
+ DATA_MAPPING_EXPRESSION
}
public static ValueType valueTypeFrom(String s) {
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj17.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj17.json
new file mode 100644
index 0000000000..5984aff632
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj17.json
@@ -0,0 +1,549 @@
+{
+ "description": "",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 7,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "string",
+ "placeholder": "\"\"",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "name",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "name",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "email",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "email",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "address",
+ "kind": "Field",
+ "detail": "Address",
+ "sortText": "CA",
+ "insertText": "address",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "reduce(function (map:Type1 accum, map:Type val) returns map:Type1 func, map:Type1 initial)",
+ "kind": "Function",
+ "detail": "map:Type1",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nCombines the members of a map using a combining function.\n\nThe combining function takes the combined value so far and a member of the map,\nand returns a new combined value.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.reduce(isolated function (int total, int next) returns int => total + next, 0) ⇒ 195\n```\n \n**Params** \n- `function (map:Type1 accum, map:Type val) returns map:Type1` func: combining function \n- `map:Type1` initial: initial value for the first argument of combining parameter `func` \n \n**Return** `map:Type1` \n- result of combining the members of parameter `m` using parameter `func` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "reduce",
+ "insertText": "reduce(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "hasKey(string k)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nTests whether a map value has a member with a given key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.hasKey(\"Carl\") ⇒ true\nmarks.hasKey(\"John\") ⇒ false\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `boolean` \n- true if parameter `m` has a member with key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "hasKey",
+ "insertText": "hasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "forEach(function (map:Type val) returns () func)",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function to each member of a map.\n\nThe parameter `func` is applied to each member of parameter `m`.\n\n```ballerina\nint total = 0;\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.forEach(function (int m) {\n total += m;\n});\ntotal ⇒ 195\n```\n \n**Params** \n- `function (map:Type val) returns ()` func: a function to apply to each member"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "forEach",
+ "insertText": "forEach(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "keys()",
+ "kind": "Function",
+ "detail": "string[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the keys of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.keys() ⇒ [\"Carl\",\"Bob\",\"Max\"]\n```\n \n \n \n**Return** `string[]` \n- a new list of all keys \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "keys",
+ "insertText": "keys()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "length()",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns number of members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.length() ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of members in parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "length",
+ "insertText": "length()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "remove(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map.\n\nThis removes the member of parameter `m` with key parameter `k` and returns it.\nIt panics if there is no such member.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.remove(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.remove(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- the member of parameter `m` that had key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "remove",
+ "insertText": "remove(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "filter(function (map:Type val) returns boolean func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nSelects the members from a map for which a function returns true.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.filter(m => m >= 60) ⇒ {\"Carl\":85,\"Max\":60}\n```\n \n**Params** \n- `function (map:Type val) returns boolean` func: a predicate to apply to each element to test whether it should be included \n \n**Return** `map` \n- new map containing members for which parameter `func` evaluates to true \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "filter",
+ "insertText": "filter(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "removeIfHasKey(string k)",
+ "kind": "Function",
+ "detail": "map:Type?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map with a given key, if the map has member with the key.\n\nIf parameter `m` has a member with key parameter `k`, it removes and returns it;\notherwise it returns `()`.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeIfHasKey(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.removeIfHasKey(\"John\") is () ⇒ true\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type?` \n- the member of parameter `m` that had key parameter `k`, or `()` if parameter `m` does not have a key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeIfHasKey",
+ "insertText": "removeIfHasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "iterator()",
+ "kind": "Function",
+ "detail": "object {public isolated function next() returns record {|map:Type value;|}?;}",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns an iterator over a map.\n\nThe iterator will iterate over the members of the map not the keys.\nThe function `entries` can be used to iterate over the keys and members together.\nThe function `keys` can be used to iterator over just the keys.\n\n```ballerina\nobject {\n public isolated function next() returns record {|int value;|}?;\n} iterator = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.iterator();\niterator.next() ⇒ {\"value\":85}\n```\n \n \n \n**Return** `object {public isolated function next() returns record {|map:Type value;|}?;}` \n- a new iterator object that will iterate over the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "iterator",
+ "insertText": "iterator()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "entries()",
+ "kind": "Function",
+ "detail": "map<[string, map:Type]>",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a map containing [key, member] pair as the value for each key.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50}.entries() ⇒ {\"Carl\":[\"Carl\",85],\"Bob\":[\"Bob\",50]}\n```\n \n \n \n**Return** `map<[string, map:Type]>` \n- a new map of [key, member] pairs \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "entries",
+ "insertText": "entries()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "removeAll()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves all members of a map.\n\nThis panics if any member cannot be removed.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeAll();\nmarks ⇒ {}\nmap values = {x: 10, y: 20};\nvalues.removeAll() ⇒ panic;\n```\n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeAll",
+ "insertText": "removeAll()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "get(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns the member of a map with given key.\n\nThis for use in a case where it is known that the map has a specific key,\nand accordingly panics if parameter `m` does not have a member with parameter `k` key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.get(\"Carl\") ⇒ 85\nmarks.get(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- member with parameter `k` key \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "get",
+ "insertText": "get(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toArray()",
+ "kind": "Function",
+ "detail": "map:Type[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.toArray() ⇒ [85,50,60]\n```\n \n \n \n**Return** `map:Type[]` \n- an array whose members are the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toArray",
+ "insertText": "toArray()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "'map(function (map:Type val) returns map:Type1 func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function each member of a map and returns a map of the result.\n\nThe resulting map will have the same keys as the argument map.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.map(m => m > 50) ⇒ {\"Carl\":true,\"Bob\":false,\"Max\":true}\n```\n \n**Params** \n- `function (map:Type val) returns map:Type1` func: a function to apply to each member \n \n**Return** `map` \n- new map containing result of applying parameter `func` to each member \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "'map",
+ "insertText": "'map(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConstructs a value with a specified type by cloning another value.\n\nWhen parameter `v` is a structural value, the inherent type of the value to be constructed\ncomes from parameter `t`. When parameter `t` is a union, it must be possible to determine which\nmember of the union to use for the inherent type by following the same rules\nthat are used by list constructor expressions and mapping constructor expressions\nwith the contextually expected type. If not, then an error is returned.\nThe `cloneWithType` operation is recursively applied to each member of parameter `v` using\nthe type descriptor that the inherent type requires for that member.\n\nLike the Clone abstract operation, this does a deep copy, but differs in\nthe following respects:\n- the inherent type of any structural values constructed comes from the specified\ntype descriptor rather than the value being constructed\n- the read-only bit of values and fields comes from the specified type descriptor\n- the graph structure of `v` is not preserved; the result will always be a tree;\nan error will be returned if `v` has cycles\n- immutable structural values are copied rather being returned as is; all\nstructural values in the result will be mutable.\n- numeric values can be converted using the NumericConvert abstract operation\n- if a record type descriptor specifies default values, these will be used\nto supply any missing members\n\n```ballerina\nanydata[] arr = [1, 2, 3, 4];\nint[] intArray = check arr.cloneWithType();\nintArray ⇒ [1,2,3,4]\narr === intArray ⇒ false\ntype Vowels string:Char[];\nstring[] vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.cloneWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.cloneWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: the type for the cloned to be constructed(Defaultable) \n \n**Return** `t|error` \n- a new value that belongs to parameter `t`, or an error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneWithType",
+ "insertText": "cloneWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "last(value:Type... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the last argument.\n\n```ballerina\nvalue:last(1, 2, 3) ⇒ 3\n```\n \n**Params** \n- `value:Type[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- last argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "last",
+ "insertText": "last(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneReadOnly()",
+ "kind": "Function",
+ "detail": "value:CloneableType & readonly",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value that is read-only, i.e., immutable.\n\nIt corresponds to the ImmutableClone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] & readonly immutableClone = arr.cloneReadOnly();\nimmutableClone ⇒ [1,2,3,4]\nimmutableClone is readonly ⇒ true \n```\n \n \n \n**Return** `value:CloneableType & readonly` \n- immutable clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneReadOnly",
+ "insertText": "cloneReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "count(any|error... vs)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the number of arguments.\n\n```ballerina\nvalue:count(1, 2, 3) ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of arguments \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "count",
+ "insertText": "count(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBalString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value to a string that describes the value in Ballerina syntax.\n\nIf parameter `v` is anydata and does not have cycles, then the result will\nconform to the grammar for a Ballerina expression and when evaluated\nwill result in a value that is == to parameter `v`.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the expression style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toBalString() ⇒ 12.12d\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toBalString() ⇒ [1,\"Sam\",12.3,12.12d,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toBalString",
+ "insertText": "toBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "toJson()",
+ "kind": "Function",
+ "detail": "json",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type `anydata` to `json`.\n\nThis does a deep copy of parameter `v` converting values that do\nnot belong to json into values that do.\nA value of type `xml` is converted into a string as if\nby the `toString` function.\nA value of type `table` is converted into a list of\nmappings one for each row.\nThe inherent type of arrays in the return value will be\n`json[]` and of mappings will be `map`.\nA new copy is made of all structural values, including\nimmutable values.\nThis panics if parameter `v` has cycles.\n\n```ballerina\nanydata student = {name: \"Jo\", age: 11};\nstudent.toJson() ⇒ {\"name\":\"Jo\",\"age\":11}\nanydata[] array = [];\narray.push(array);\narray.toJson() ⇒ panic\n```\n \n \n \n**Return** `json` \n- representation of `v` as value of type json \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toJson",
+ "insertText": "toJson()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isReadOnly()",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nTests whether a value is read-only, i.e., immutable.\n\nReturns true if read-only, false otherwise.\n\n```ballerina\nint[] scores = [21, 12, 33, 45, 81];\nscores.isReadOnly() ⇒ true\nstring[] sports = [\"cricket\", \"football\", \"rugby\"];\nsports.isReadOnly() ⇒ false\n```\n \n \n \n**Return** `boolean` \n- true if read-only, false otherwise \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "isReadOnly",
+ "insertText": "isReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type json to a user-specified type.\n\nThis works the same as function `cloneWithType`,\nexcept that it also does the inverse of the conversions done by `toJson`.\n\n```ballerina\njson arr = [1, 2, 3, 4];\nint[] intArray = check arr.fromJsonWithType();\nintArray ⇒ [1,2,3,4]\ntype Vowels string:Char[];\njson vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.fromJsonWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.fromJsonWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "fromJsonWithType",
+ "insertText": "fromJsonWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "mergeJson(json j2)",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nMerges two `json` values.\n\nThe merge of parameter `j1` with parameter `j2` is defined as follows:\n- if parameter `j1` is `()`, then the result is parameter `j2`\n- if parameter `j2` is `()`, then the result is parameter `j1`\n- if parameter `j1` is a mapping and parameter `j2` is a mapping, then for each entry [k, j] in parameter `j2`, set `j1[k]` to the merge of `j1[k]` with `j`\n- if `j1[k]` is undefined, then set `j1[k]` to `j`\n- if any merge fails, then the merge of parameter `j1` with parameter `j2` fails\n- otherwise, the result is parameter `j1`.\n- otherwise, the merge fails\nIf the merge fails, then parameter `j1` is unchanged.\n\n```ballerina\njson student = {name: \"John\", age: 23};\njson location = {city: \"Colombo\", country: \"Sri Lanka\"};\nstudent.mergeJson(location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\nvalue:mergeJson(student, location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\njson city = \"Colombo\";\nstudent.mergeJson(city) ⇒ error\n```\n \n**Params** \n- `json` j2: json value \n \n**Return** `json|error` \n- the merge of parameter `j1` with parameter `j2` or an error if the merge fails \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "mergeJson",
+ "insertText": "mergeJson(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "clone()",
+ "kind": "Function",
+ "detail": "value:CloneableType",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value.\n\nA clone is a deep copy that does not copy immutable subtrees.\nA clone can therefore safely be used concurrently with the original.\nIt corresponds to the Clone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] clone = arr.clone();\nclone ⇒ [1,2,3,4]\narr === clone ⇒ false\n```\n \n \n \n**Return** `value:CloneableType` \n- clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "clone",
+ "insertText": "clone()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "ensureType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nSafely casts a value to a type.\n\nThis casts a value to a type in the same way as a type cast expression,\nbut returns an error if the cast cannot be done, rather than panicking.\n\n```ballerina\njson student = {name: \"Jo\", subjects: [\"CS1212\", \"CS2021\"]};\njson[] subjects = check student.subjects.ensureType();\nsubjects ⇒ [\"CS1212\",\"CS2021\"]\nanydata vowel = \"I\";\nvowel.ensureType(string:Char) ⇒ I;\nvowel.ensureType(int) ⇒ error\n```\n \n**Params** \n- `typedesc` t: a typedesc for the type to which to cast it(Defaultable) \n \n**Return** `t|error` \n- `v` cast to the type described by parameter `t`, or an error, if the cast cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "ensureType",
+ "insertText": "ensureType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nPerforms a direct conversion of a value to a string.\n\nThe conversion is direct in the sense that when applied to a value that is already\na string it leaves the value unchanged.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the direct style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toString() ⇒ 12.12\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toString() ⇒ [1,\"Sam\",12.3,12.12,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toString",
+ "insertText": "toString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "first(any|error... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the first argument.\n\n```ballerina\nvalue:first(1, 2, 3) ⇒ 1\n```\n \n**Params** \n- `(any|error)[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- first argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "first",
+ "insertText": "first(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJsonString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the string that represents a anydata value in JSON format.\n\nparameter `v` is first converted to `json` as if by the function `toJson`.\n\n```ballerina\nanydata marks = {\"Alice\": 90, \"Bob\": 85, \"Jo\": 91};\nmarks.toJsonString() ⇒ {\"Alice\":90, \"Bob\":85, \"Jo\":91}\n```\n \n \n \n**Return** `string` \n- string representation of parameter `v` converted to `json` \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toJsonString",
+ "insertText": "toJsonString()",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj18.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj18.json
new file mode 100644
index 0000000000..21f0f11709
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj18.json
@@ -0,0 +1,565 @@
+{
+ "description": "Nested field access - person.address.",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.address.",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 15,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "string",
+ "placeholder": "\"\"",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "houseNo",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "houseNo",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "line1",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "line1",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "line2",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "line2",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "city",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "city",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "country",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "country",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "reduce(function (map:Type1 accum, map:Type val) returns map:Type1 func, map:Type1 initial)",
+ "kind": "Function",
+ "detail": "map:Type1",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nCombines the members of a map using a combining function.\n\nThe combining function takes the combined value so far and a member of the map,\nand returns a new combined value.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.reduce(isolated function (int total, int next) returns int => total + next, 0) ⇒ 195\n```\n \n**Params** \n- `function (map:Type1 accum, map:Type val) returns map:Type1` func: combining function \n- `map:Type1` initial: initial value for the first argument of combining parameter `func` \n \n**Return** `map:Type1` \n- result of combining the members of parameter `m` using parameter `func` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "reduce",
+ "insertText": "reduce(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "hasKey(string k)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nTests whether a map value has a member with a given key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.hasKey(\"Carl\") ⇒ true\nmarks.hasKey(\"John\") ⇒ false\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `boolean` \n- true if parameter `m` has a member with key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "hasKey",
+ "insertText": "hasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "forEach(function (map:Type val) returns () func)",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function to each member of a map.\n\nThe parameter `func` is applied to each member of parameter `m`.\n\n```ballerina\nint total = 0;\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.forEach(function (int m) {\n total += m;\n});\ntotal ⇒ 195\n```\n \n**Params** \n- `function (map:Type val) returns ()` func: a function to apply to each member"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "forEach",
+ "insertText": "forEach(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "keys()",
+ "kind": "Function",
+ "detail": "string[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the keys of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.keys() ⇒ [\"Carl\",\"Bob\",\"Max\"]\n```\n \n \n \n**Return** `string[]` \n- a new list of all keys \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "keys",
+ "insertText": "keys()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "length()",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns number of members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.length() ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of members in parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "length",
+ "insertText": "length()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "remove(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map.\n\nThis removes the member of parameter `m` with key parameter `k` and returns it.\nIt panics if there is no such member.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.remove(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.remove(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- the member of parameter `m` that had key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "remove",
+ "insertText": "remove(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "filter(function (map:Type val) returns boolean func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nSelects the members from a map for which a function returns true.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.filter(m => m >= 60) ⇒ {\"Carl\":85,\"Max\":60}\n```\n \n**Params** \n- `function (map:Type val) returns boolean` func: a predicate to apply to each element to test whether it should be included \n \n**Return** `map` \n- new map containing members for which parameter `func` evaluates to true \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "filter",
+ "insertText": "filter(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "removeIfHasKey(string k)",
+ "kind": "Function",
+ "detail": "map:Type?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map with a given key, if the map has member with the key.\n\nIf parameter `m` has a member with key parameter `k`, it removes and returns it;\notherwise it returns `()`.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeIfHasKey(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.removeIfHasKey(\"John\") is () ⇒ true\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type?` \n- the member of parameter `m` that had key parameter `k`, or `()` if parameter `m` does not have a key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeIfHasKey",
+ "insertText": "removeIfHasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "iterator()",
+ "kind": "Function",
+ "detail": "object {public isolated function next() returns record {|map:Type value;|}?;}",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns an iterator over a map.\n\nThe iterator will iterate over the members of the map not the keys.\nThe function `entries` can be used to iterate over the keys and members together.\nThe function `keys` can be used to iterator over just the keys.\n\n```ballerina\nobject {\n public isolated function next() returns record {|int value;|}?;\n} iterator = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.iterator();\niterator.next() ⇒ {\"value\":85}\n```\n \n \n \n**Return** `object {public isolated function next() returns record {|map:Type value;|}?;}` \n- a new iterator object that will iterate over the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "iterator",
+ "insertText": "iterator()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "entries()",
+ "kind": "Function",
+ "detail": "map<[string, map:Type]>",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a map containing [key, member] pair as the value for each key.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50}.entries() ⇒ {\"Carl\":[\"Carl\",85],\"Bob\":[\"Bob\",50]}\n```\n \n \n \n**Return** `map<[string, map:Type]>` \n- a new map of [key, member] pairs \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "entries",
+ "insertText": "entries()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "removeAll()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves all members of a map.\n\nThis panics if any member cannot be removed.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeAll();\nmarks ⇒ {}\nmap values = {x: 10, y: 20};\nvalues.removeAll() ⇒ panic;\n```\n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeAll",
+ "insertText": "removeAll()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "get(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns the member of a map with given key.\n\nThis for use in a case where it is known that the map has a specific key,\nand accordingly panics if parameter `m` does not have a member with parameter `k` key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.get(\"Carl\") ⇒ 85\nmarks.get(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- member with parameter `k` key \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "get",
+ "insertText": "get(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toArray()",
+ "kind": "Function",
+ "detail": "map:Type[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.toArray() ⇒ [85,50,60]\n```\n \n \n \n**Return** `map:Type[]` \n- an array whose members are the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toArray",
+ "insertText": "toArray()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "'map(function (map:Type val) returns map:Type1 func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function each member of a map and returns a map of the result.\n\nThe resulting map will have the same keys as the argument map.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.map(m => m > 50) ⇒ {\"Carl\":true,\"Bob\":false,\"Max\":true}\n```\n \n**Params** \n- `function (map:Type val) returns map:Type1` func: a function to apply to each member \n \n**Return** `map` \n- new map containing result of applying parameter `func` to each member \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "'map",
+ "insertText": "'map(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConstructs a value with a specified type by cloning another value.\n\nWhen parameter `v` is a structural value, the inherent type of the value to be constructed\ncomes from parameter `t`. When parameter `t` is a union, it must be possible to determine which\nmember of the union to use for the inherent type by following the same rules\nthat are used by list constructor expressions and mapping constructor expressions\nwith the contextually expected type. If not, then an error is returned.\nThe `cloneWithType` operation is recursively applied to each member of parameter `v` using\nthe type descriptor that the inherent type requires for that member.\n\nLike the Clone abstract operation, this does a deep copy, but differs in\nthe following respects:\n- the inherent type of any structural values constructed comes from the specified\ntype descriptor rather than the value being constructed\n- the read-only bit of values and fields comes from the specified type descriptor\n- the graph structure of `v` is not preserved; the result will always be a tree;\nan error will be returned if `v` has cycles\n- immutable structural values are copied rather being returned as is; all\nstructural values in the result will be mutable.\n- numeric values can be converted using the NumericConvert abstract operation\n- if a record type descriptor specifies default values, these will be used\nto supply any missing members\n\n```ballerina\nanydata[] arr = [1, 2, 3, 4];\nint[] intArray = check arr.cloneWithType();\nintArray ⇒ [1,2,3,4]\narr === intArray ⇒ false\ntype Vowels string:Char[];\nstring[] vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.cloneWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.cloneWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: the type for the cloned to be constructed(Defaultable) \n \n**Return** `t|error` \n- a new value that belongs to parameter `t`, or an error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneWithType",
+ "insertText": "cloneWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "last(value:Type... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the last argument.\n\n```ballerina\nvalue:last(1, 2, 3) ⇒ 3\n```\n \n**Params** \n- `value:Type[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- last argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "last",
+ "insertText": "last(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneReadOnly()",
+ "kind": "Function",
+ "detail": "value:CloneableType & readonly",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value that is read-only, i.e., immutable.\n\nIt corresponds to the ImmutableClone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] & readonly immutableClone = arr.cloneReadOnly();\nimmutableClone ⇒ [1,2,3,4]\nimmutableClone is readonly ⇒ true \n```\n \n \n \n**Return** `value:CloneableType & readonly` \n- immutable clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneReadOnly",
+ "insertText": "cloneReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "count(any|error... vs)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the number of arguments.\n\n```ballerina\nvalue:count(1, 2, 3) ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of arguments \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "count",
+ "insertText": "count(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBalString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value to a string that describes the value in Ballerina syntax.\n\nIf parameter `v` is anydata and does not have cycles, then the result will\nconform to the grammar for a Ballerina expression and when evaluated\nwill result in a value that is == to parameter `v`.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the expression style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toBalString() ⇒ 12.12d\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toBalString() ⇒ [1,\"Sam\",12.3,12.12d,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toBalString",
+ "insertText": "toBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "toJson()",
+ "kind": "Function",
+ "detail": "json",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type `anydata` to `json`.\n\nThis does a deep copy of parameter `v` converting values that do\nnot belong to json into values that do.\nA value of type `xml` is converted into a string as if\nby the `toString` function.\nA value of type `table` is converted into a list of\nmappings one for each row.\nThe inherent type of arrays in the return value will be\n`json[]` and of mappings will be `map`.\nA new copy is made of all structural values, including\nimmutable values.\nThis panics if parameter `v` has cycles.\n\n```ballerina\nanydata student = {name: \"Jo\", age: 11};\nstudent.toJson() ⇒ {\"name\":\"Jo\",\"age\":11}\nanydata[] array = [];\narray.push(array);\narray.toJson() ⇒ panic\n```\n \n \n \n**Return** `json` \n- representation of `v` as value of type json \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toJson",
+ "insertText": "toJson()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isReadOnly()",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nTests whether a value is read-only, i.e., immutable.\n\nReturns true if read-only, false otherwise.\n\n```ballerina\nint[] scores = [21, 12, 33, 45, 81];\nscores.isReadOnly() ⇒ true\nstring[] sports = [\"cricket\", \"football\", \"rugby\"];\nsports.isReadOnly() ⇒ false\n```\n \n \n \n**Return** `boolean` \n- true if read-only, false otherwise \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "isReadOnly",
+ "insertText": "isReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type json to a user-specified type.\n\nThis works the same as function `cloneWithType`,\nexcept that it also does the inverse of the conversions done by `toJson`.\n\n```ballerina\njson arr = [1, 2, 3, 4];\nint[] intArray = check arr.fromJsonWithType();\nintArray ⇒ [1,2,3,4]\ntype Vowels string:Char[];\njson vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.fromJsonWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.fromJsonWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "fromJsonWithType",
+ "insertText": "fromJsonWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "mergeJson(json j2)",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nMerges two `json` values.\n\nThe merge of parameter `j1` with parameter `j2` is defined as follows:\n- if parameter `j1` is `()`, then the result is parameter `j2`\n- if parameter `j2` is `()`, then the result is parameter `j1`\n- if parameter `j1` is a mapping and parameter `j2` is a mapping, then for each entry [k, j] in parameter `j2`, set `j1[k]` to the merge of `j1[k]` with `j`\n- if `j1[k]` is undefined, then set `j1[k]` to `j`\n- if any merge fails, then the merge of parameter `j1` with parameter `j2` fails\n- otherwise, the result is parameter `j1`.\n- otherwise, the merge fails\nIf the merge fails, then parameter `j1` is unchanged.\n\n```ballerina\njson student = {name: \"John\", age: 23};\njson location = {city: \"Colombo\", country: \"Sri Lanka\"};\nstudent.mergeJson(location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\nvalue:mergeJson(student, location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\njson city = \"Colombo\";\nstudent.mergeJson(city) ⇒ error\n```\n \n**Params** \n- `json` j2: json value \n \n**Return** `json|error` \n- the merge of parameter `j1` with parameter `j2` or an error if the merge fails \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "mergeJson",
+ "insertText": "mergeJson(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "clone()",
+ "kind": "Function",
+ "detail": "value:CloneableType",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value.\n\nA clone is a deep copy that does not copy immutable subtrees.\nA clone can therefore safely be used concurrently with the original.\nIt corresponds to the Clone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] clone = arr.clone();\nclone ⇒ [1,2,3,4]\narr === clone ⇒ false\n```\n \n \n \n**Return** `value:CloneableType` \n- clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "clone",
+ "insertText": "clone()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "ensureType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nSafely casts a value to a type.\n\nThis casts a value to a type in the same way as a type cast expression,\nbut returns an error if the cast cannot be done, rather than panicking.\n\n```ballerina\njson student = {name: \"Jo\", subjects: [\"CS1212\", \"CS2021\"]};\njson[] subjects = check student.subjects.ensureType();\nsubjects ⇒ [\"CS1212\",\"CS2021\"]\nanydata vowel = \"I\";\nvowel.ensureType(string:Char) ⇒ I;\nvowel.ensureType(int) ⇒ error\n```\n \n**Params** \n- `typedesc` t: a typedesc for the type to which to cast it(Defaultable) \n \n**Return** `t|error` \n- `v` cast to the type described by parameter `t`, or an error, if the cast cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "ensureType",
+ "insertText": "ensureType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nPerforms a direct conversion of a value to a string.\n\nThe conversion is direct in the sense that when applied to a value that is already\na string it leaves the value unchanged.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the direct style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toString() ⇒ 12.12\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toString() ⇒ [1,\"Sam\",12.3,12.12,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toString",
+ "insertText": "toString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "first(any|error... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the first argument.\n\n```ballerina\nvalue:first(1, 2, 3) ⇒ 1\n```\n \n**Params** \n- `(any|error)[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- first argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "first",
+ "insertText": "first(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJsonString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the string that represents a anydata value in JSON format.\n\nparameter `v` is first converted to `json` as if by the function `toJson`.\n\n```ballerina\nanydata marks = {\"Alice\": 90, \"Bob\": 85, \"Jo\": 91};\nmarks.toJsonString() ⇒ {\"Alice\":90, \"Bob\":85, \"Jo\":91}\n```\n \n \n \n**Return** `string` \n- string representation of parameter `v` converted to `json` \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toJsonString",
+ "insertText": "toJsonString()",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj19.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj19.json
new file mode 100644
index 0000000000..9728f16086
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj19.json
@@ -0,0 +1,549 @@
+{
+ "description": "Partial field name completion - person.em",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.em",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 9,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "string",
+ "placeholder": "\"\"",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "name",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "name",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "email",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "AA",
+ "insertText": "email",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "address",
+ "kind": "Field",
+ "detail": "Address",
+ "sortText": "CA",
+ "insertText": "address",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "reduce(function (map:Type1 accum, map:Type val) returns map:Type1 func, map:Type1 initial)",
+ "kind": "Function",
+ "detail": "map:Type1",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nCombines the members of a map using a combining function.\n\nThe combining function takes the combined value so far and a member of the map,\nand returns a new combined value.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.reduce(isolated function (int total, int next) returns int => total + next, 0) ⇒ 195\n```\n \n**Params** \n- `function (map:Type1 accum, map:Type val) returns map:Type1` func: combining function \n- `map:Type1` initial: initial value for the first argument of combining parameter `func` \n \n**Return** `map:Type1` \n- result of combining the members of parameter `m` using parameter `func` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "reduce",
+ "insertText": "reduce(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "hasKey(string k)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nTests whether a map value has a member with a given key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.hasKey(\"Carl\") ⇒ true\nmarks.hasKey(\"John\") ⇒ false\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `boolean` \n- true if parameter `m` has a member with key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "hasKey",
+ "insertText": "hasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "forEach(function (map:Type val) returns () func)",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function to each member of a map.\n\nThe parameter `func` is applied to each member of parameter `m`.\n\n```ballerina\nint total = 0;\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.forEach(function (int m) {\n total += m;\n});\ntotal ⇒ 195\n```\n \n**Params** \n- `function (map:Type val) returns ()` func: a function to apply to each member"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "forEach",
+ "insertText": "forEach(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "keys()",
+ "kind": "Function",
+ "detail": "string[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the keys of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.keys() ⇒ [\"Carl\",\"Bob\",\"Max\"]\n```\n \n \n \n**Return** `string[]` \n- a new list of all keys \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "keys",
+ "insertText": "keys()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "length()",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns number of members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.length() ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of members in parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "length",
+ "insertText": "length()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "remove(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map.\n\nThis removes the member of parameter `m` with key parameter `k` and returns it.\nIt panics if there is no such member.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.remove(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.remove(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- the member of parameter `m` that had key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "remove",
+ "insertText": "remove(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "filter(function (map:Type val) returns boolean func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nSelects the members from a map for which a function returns true.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.filter(m => m >= 60) ⇒ {\"Carl\":85,\"Max\":60}\n```\n \n**Params** \n- `function (map:Type val) returns boolean` func: a predicate to apply to each element to test whether it should be included \n \n**Return** `map` \n- new map containing members for which parameter `func` evaluates to true \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "filter",
+ "insertText": "filter(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "removeIfHasKey(string k)",
+ "kind": "Function",
+ "detail": "map:Type?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map with a given key, if the map has member with the key.\n\nIf parameter `m` has a member with key parameter `k`, it removes and returns it;\notherwise it returns `()`.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeIfHasKey(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.removeIfHasKey(\"John\") is () ⇒ true\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type?` \n- the member of parameter `m` that had key parameter `k`, or `()` if parameter `m` does not have a key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeIfHasKey",
+ "insertText": "removeIfHasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "iterator()",
+ "kind": "Function",
+ "detail": "object {public isolated function next() returns record {|map:Type value;|}?;}",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns an iterator over a map.\n\nThe iterator will iterate over the members of the map not the keys.\nThe function `entries` can be used to iterate over the keys and members together.\nThe function `keys` can be used to iterator over just the keys.\n\n```ballerina\nobject {\n public isolated function next() returns record {|int value;|}?;\n} iterator = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.iterator();\niterator.next() ⇒ {\"value\":85}\n```\n \n \n \n**Return** `object {public isolated function next() returns record {|map:Type value;|}?;}` \n- a new iterator object that will iterate over the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "iterator",
+ "insertText": "iterator()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "entries()",
+ "kind": "Function",
+ "detail": "map<[string, map:Type]>",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a map containing [key, member] pair as the value for each key.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50}.entries() ⇒ {\"Carl\":[\"Carl\",85],\"Bob\":[\"Bob\",50]}\n```\n \n \n \n**Return** `map<[string, map:Type]>` \n- a new map of [key, member] pairs \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "entries",
+ "insertText": "entries()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "removeAll()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves all members of a map.\n\nThis panics if any member cannot be removed.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeAll();\nmarks ⇒ {}\nmap values = {x: 10, y: 20};\nvalues.removeAll() ⇒ panic;\n```\n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeAll",
+ "insertText": "removeAll()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "get(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns the member of a map with given key.\n\nThis for use in a case where it is known that the map has a specific key,\nand accordingly panics if parameter `m` does not have a member with parameter `k` key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.get(\"Carl\") ⇒ 85\nmarks.get(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- member with parameter `k` key \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "get",
+ "insertText": "get(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toArray()",
+ "kind": "Function",
+ "detail": "map:Type[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.toArray() ⇒ [85,50,60]\n```\n \n \n \n**Return** `map:Type[]` \n- an array whose members are the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toArray",
+ "insertText": "toArray()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "'map(function (map:Type val) returns map:Type1 func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function each member of a map and returns a map of the result.\n\nThe resulting map will have the same keys as the argument map.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.map(m => m > 50) ⇒ {\"Carl\":true,\"Bob\":false,\"Max\":true}\n```\n \n**Params** \n- `function (map:Type val) returns map:Type1` func: a function to apply to each member \n \n**Return** `map` \n- new map containing result of applying parameter `func` to each member \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "'map",
+ "insertText": "'map(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConstructs a value with a specified type by cloning another value.\n\nWhen parameter `v` is a structural value, the inherent type of the value to be constructed\ncomes from parameter `t`. When parameter `t` is a union, it must be possible to determine which\nmember of the union to use for the inherent type by following the same rules\nthat are used by list constructor expressions and mapping constructor expressions\nwith the contextually expected type. If not, then an error is returned.\nThe `cloneWithType` operation is recursively applied to each member of parameter `v` using\nthe type descriptor that the inherent type requires for that member.\n\nLike the Clone abstract operation, this does a deep copy, but differs in\nthe following respects:\n- the inherent type of any structural values constructed comes from the specified\ntype descriptor rather than the value being constructed\n- the read-only bit of values and fields comes from the specified type descriptor\n- the graph structure of `v` is not preserved; the result will always be a tree;\nan error will be returned if `v` has cycles\n- immutable structural values are copied rather being returned as is; all\nstructural values in the result will be mutable.\n- numeric values can be converted using the NumericConvert abstract operation\n- if a record type descriptor specifies default values, these will be used\nto supply any missing members\n\n```ballerina\nanydata[] arr = [1, 2, 3, 4];\nint[] intArray = check arr.cloneWithType();\nintArray ⇒ [1,2,3,4]\narr === intArray ⇒ false\ntype Vowels string:Char[];\nstring[] vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.cloneWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.cloneWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: the type for the cloned to be constructed(Defaultable) \n \n**Return** `t|error` \n- a new value that belongs to parameter `t`, or an error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneWithType",
+ "insertText": "cloneWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "last(value:Type... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the last argument.\n\n```ballerina\nvalue:last(1, 2, 3) ⇒ 3\n```\n \n**Params** \n- `value:Type[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- last argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "last",
+ "insertText": "last(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneReadOnly()",
+ "kind": "Function",
+ "detail": "value:CloneableType & readonly",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value that is read-only, i.e., immutable.\n\nIt corresponds to the ImmutableClone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] & readonly immutableClone = arr.cloneReadOnly();\nimmutableClone ⇒ [1,2,3,4]\nimmutableClone is readonly ⇒ true \n```\n \n \n \n**Return** `value:CloneableType & readonly` \n- immutable clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneReadOnly",
+ "insertText": "cloneReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "count(any|error... vs)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the number of arguments.\n\n```ballerina\nvalue:count(1, 2, 3) ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of arguments \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "count",
+ "insertText": "count(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBalString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value to a string that describes the value in Ballerina syntax.\n\nIf parameter `v` is anydata and does not have cycles, then the result will\nconform to the grammar for a Ballerina expression and when evaluated\nwill result in a value that is == to parameter `v`.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the expression style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toBalString() ⇒ 12.12d\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toBalString() ⇒ [1,\"Sam\",12.3,12.12d,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toBalString",
+ "insertText": "toBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "toJson()",
+ "kind": "Function",
+ "detail": "json",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type `anydata` to `json`.\n\nThis does a deep copy of parameter `v` converting values that do\nnot belong to json into values that do.\nA value of type `xml` is converted into a string as if\nby the `toString` function.\nA value of type `table` is converted into a list of\nmappings one for each row.\nThe inherent type of arrays in the return value will be\n`json[]` and of mappings will be `map`.\nA new copy is made of all structural values, including\nimmutable values.\nThis panics if parameter `v` has cycles.\n\n```ballerina\nanydata student = {name: \"Jo\", age: 11};\nstudent.toJson() ⇒ {\"name\":\"Jo\",\"age\":11}\nanydata[] array = [];\narray.push(array);\narray.toJson() ⇒ panic\n```\n \n \n \n**Return** `json` \n- representation of `v` as value of type json \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toJson",
+ "insertText": "toJson()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isReadOnly()",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nTests whether a value is read-only, i.e., immutable.\n\nReturns true if read-only, false otherwise.\n\n```ballerina\nint[] scores = [21, 12, 33, 45, 81];\nscores.isReadOnly() ⇒ true\nstring[] sports = [\"cricket\", \"football\", \"rugby\"];\nsports.isReadOnly() ⇒ false\n```\n \n \n \n**Return** `boolean` \n- true if read-only, false otherwise \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "isReadOnly",
+ "insertText": "isReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type json to a user-specified type.\n\nThis works the same as function `cloneWithType`,\nexcept that it also does the inverse of the conversions done by `toJson`.\n\n```ballerina\njson arr = [1, 2, 3, 4];\nint[] intArray = check arr.fromJsonWithType();\nintArray ⇒ [1,2,3,4]\ntype Vowels string:Char[];\njson vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.fromJsonWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.fromJsonWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "fromJsonWithType",
+ "insertText": "fromJsonWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "mergeJson(json j2)",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nMerges two `json` values.\n\nThe merge of parameter `j1` with parameter `j2` is defined as follows:\n- if parameter `j1` is `()`, then the result is parameter `j2`\n- if parameter `j2` is `()`, then the result is parameter `j1`\n- if parameter `j1` is a mapping and parameter `j2` is a mapping, then for each entry [k, j] in parameter `j2`, set `j1[k]` to the merge of `j1[k]` with `j`\n- if `j1[k]` is undefined, then set `j1[k]` to `j`\n- if any merge fails, then the merge of parameter `j1` with parameter `j2` fails\n- otherwise, the result is parameter `j1`.\n- otherwise, the merge fails\nIf the merge fails, then parameter `j1` is unchanged.\n\n```ballerina\njson student = {name: \"John\", age: 23};\njson location = {city: \"Colombo\", country: \"Sri Lanka\"};\nstudent.mergeJson(location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\nvalue:mergeJson(student, location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\njson city = \"Colombo\";\nstudent.mergeJson(city) ⇒ error\n```\n \n**Params** \n- `json` j2: json value \n \n**Return** `json|error` \n- the merge of parameter `j1` with parameter `j2` or an error if the merge fails \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "mergeJson",
+ "insertText": "mergeJson(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "clone()",
+ "kind": "Function",
+ "detail": "value:CloneableType",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value.\n\nA clone is a deep copy that does not copy immutable subtrees.\nA clone can therefore safely be used concurrently with the original.\nIt corresponds to the Clone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] clone = arr.clone();\nclone ⇒ [1,2,3,4]\narr === clone ⇒ false\n```\n \n \n \n**Return** `value:CloneableType` \n- clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "clone",
+ "insertText": "clone()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "ensureType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nSafely casts a value to a type.\n\nThis casts a value to a type in the same way as a type cast expression,\nbut returns an error if the cast cannot be done, rather than panicking.\n\n```ballerina\njson student = {name: \"Jo\", subjects: [\"CS1212\", \"CS2021\"]};\njson[] subjects = check student.subjects.ensureType();\nsubjects ⇒ [\"CS1212\",\"CS2021\"]\nanydata vowel = \"I\";\nvowel.ensureType(string:Char) ⇒ I;\nvowel.ensureType(int) ⇒ error\n```\n \n**Params** \n- `typedesc` t: a typedesc for the type to which to cast it(Defaultable) \n \n**Return** `t|error` \n- `v` cast to the type described by parameter `t`, or an error, if the cast cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "ensureType",
+ "insertText": "ensureType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nPerforms a direct conversion of a value to a string.\n\nThe conversion is direct in the sense that when applied to a value that is already\na string it leaves the value unchanged.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the direct style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toString() ⇒ 12.12\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toString() ⇒ [1,\"Sam\",12.3,12.12,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toString",
+ "insertText": "toString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "first(any|error... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the first argument.\n\n```ballerina\nvalue:first(1, 2, 3) ⇒ 1\n```\n \n**Params** \n- `(any|error)[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- first argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "first",
+ "insertText": "first(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJsonString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the string that represents a anydata value in JSON format.\n\nparameter `v` is first converted to `json` as if by the function `toJson`.\n\n```ballerina\nanydata marks = {\"Alice\": 90, \"Bob\": 85, \"Jo\": 91};\nmarks.toJsonString() ⇒ {\"Alice\":90, \"Bob\":85, \"Jo\":91}\n```\n \n \n \n**Return** `string` \n- string representation of parameter `v` converted to `json` \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "toJsonString",
+ "insertText": "toJsonString()",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj20.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj20.json
new file mode 100644
index 0000000000..0fc8d78b84
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj20.json
@@ -0,0 +1,715 @@
+{
+ "description": "Binary operation - admission.empId + ",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "admission.empId + ",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 18,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "int",
+ "placeholder": "0",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "start",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "start",
+ "insertText": "start ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "wait",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "wait",
+ "insertText": "wait ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "flush",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "flush",
+ "insertText": "flush ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "from clause",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "from",
+ "insertText": "from ${1:var} ${2:item} in ${3}",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "natural",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "natural",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "decimal",
+ "kind": "TypeParameter",
+ "detail": "Decimal",
+ "sortText": "R",
+ "insertText": "decimal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "error",
+ "kind": "Event",
+ "detail": "Error",
+ "sortText": "P",
+ "insertText": "error",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "object",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "object",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "transaction",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "transaction",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "xml",
+ "kind": "TypeParameter",
+ "detail": "Xml",
+ "sortText": "R",
+ "insertText": "xml",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "table",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "table",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "map",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "map",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "stream",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "stream",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "boolean",
+ "kind": "TypeParameter",
+ "detail": "Boolean",
+ "sortText": "R",
+ "insertText": "boolean",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "future",
+ "kind": "TypeParameter",
+ "detail": "Future",
+ "sortText": "R",
+ "insertText": "future",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "int",
+ "kind": "TypeParameter",
+ "detail": "Int",
+ "sortText": "R",
+ "insertText": "int",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "float",
+ "kind": "TypeParameter",
+ "detail": "Float",
+ "sortText": "R",
+ "insertText": "float",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "function",
+ "kind": "TypeParameter",
+ "detail": "Function",
+ "sortText": "R",
+ "insertText": "function",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "string",
+ "kind": "TypeParameter",
+ "detail": "String",
+ "sortText": "R",
+ "insertText": "string",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "typedesc",
+ "kind": "TypeParameter",
+ "detail": "Typedesc",
+ "sortText": "R",
+ "insertText": "typedesc",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "service",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "service",
+ "insertText": "service",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "new",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "new",
+ "insertText": "new ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isolated",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "isolated",
+ "insertText": "isolated ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "transactional",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "transactional",
+ "insertText": "transactional",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "function",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "function",
+ "insertText": "function ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "let",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "let",
+ "insertText": "let",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "typeof",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "typeof",
+ "insertText": "typeof ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "trap",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "trap",
+ "insertText": "trap",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "client",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "client",
+ "insertText": "client ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "true",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "true",
+ "insertText": "true",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "false",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "false",
+ "insertText": "false",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "null",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "null",
+ "insertText": "null",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "check",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "check",
+ "insertText": "check ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "checkpanic",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "checkpanic",
+ "insertText": "checkpanic ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "is",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "is",
+ "insertText": "is",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "error constructor",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "error",
+ "insertText": "error(\"${1}\")",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "object constructor",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "object",
+ "insertText": "object {${1}}",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "base16",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "base16",
+ "insertText": "base16 `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "base64",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "base64",
+ "insertText": "base64 `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "from",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "from",
+ "insertText": "from ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "re ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "re ``",
+ "insertText": "re `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "string ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "string ``",
+ "insertText": "string `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "xml ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "xml ``",
+ "insertText": "xml `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "natural (..) {..}",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "natural (..) {..}",
+ "insertText": "natural (${1}) {${2}}",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Address",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Address",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Admission",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Admission",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Employee",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Employee",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Location",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Location",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "MyOk",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "MyOk",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Person",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Person",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "StrandData",
+ "kind": "Struct",
+ "detail": "Record",
+ "documentation": {
+ "left": "Describes Strand execution details for the runtime.\n"
+ },
+ "sortText": "Q",
+ "insertText": "StrandData",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Thread",
+ "kind": "TypeParameter",
+ "detail": "Union",
+ "sortText": "R",
+ "insertText": "Thread",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "add(int a, int b)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nAdds two integers and returns the result.\n\n```\nint result = add(5, 3);\n// result will be 8\n``` \n**Params** \n- `int` a: The first integer to be added \n- `int` b: The second integer to be added\n \n \n**Return** `int` \n- The sum of the two integers \n \n# Example \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "add",
+ "insertText": "add(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "admission",
+ "kind": "Variable",
+ "detail": "Admission",
+ "sortText": "F",
+ "insertText": "admission",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "firstVal",
+ "kind": "Variable",
+ "detail": "\"first\"",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": ""
+ }
+ },
+ "sortText": "AB",
+ "insertText": "firstVal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "greet(string name)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `string` name \n \n**Return** `string` \n \n"
+ }
+ },
+ "sortText": "AC",
+ "filterText": "greet",
+ "insertText": "greet(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "main()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n"
+ }
+ },
+ "sortText": "ZD",
+ "filterText": "main",
+ "insertText": "main()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "person",
+ "kind": "Variable",
+ "detail": "Person",
+ "sortText": "F",
+ "insertText": "person",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "prefixSum(int[] numbers)",
+ "kind": "Function",
+ "detail": "int[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nComputes the prefix sum of an array of integers.\n\nThe prefix sum of an array is a new array where each element at index `i` is the sum of the elements\nfrom the start of the array up to index `i`.\n \n**Params** \n- `int[]` numbers: The array of integers for which the prefix sum is to be computed. \n \n**Return** `int[]` \n- An array of integers representing the prefix sum of the input array. \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "prefixSum",
+ "insertText": "prefixSum(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "safeDivide(float a, float b)",
+ "kind": "Function",
+ "detail": "float|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nPerforms a safe division operation.\n\nThis function divides the given numerator by the denominator and returns the result.\nIf the denominator is zero, it returns an error indicating a division by zero.\n \n**Params** \n- `float` a: The numerator of type `float`. \n- `float` b: The denominator of type `float`.\n\n# Returns\n- `float` - The result of the division if the denominator is not zero.\n- `error` - An error indicating division by zero if the denominator is zero.\n \n \n**Return** `float|error` \n- The result of the division or an error. \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "safeDivide",
+ "insertText": "safeDivide(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "secondVal",
+ "kind": "Variable",
+ "detail": "string",
+ "sortText": "AB",
+ "insertText": "secondVal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "sum(int... numbers)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `int[]` numbers \n \n**Return** `int` \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "sum",
+ "insertText": "sum(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "transform(Person person, Admission admission)",
+ "kind": "Function",
+ "detail": "Employee",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `Person` person \n- `Admission` admission \n \n**Return** `Employee` \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "transform",
+ "insertText": "transform(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "readonly",
+ "kind": "TypeParameter",
+ "detail": "Readonly",
+ "sortText": "R",
+ "insertText": "readonly",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "handle",
+ "kind": "TypeParameter",
+ "detail": "Handle",
+ "sortText": "R",
+ "insertText": "handle",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "never",
+ "kind": "TypeParameter",
+ "detail": "Never",
+ "sortText": "R",
+ "insertText": "never",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "json",
+ "kind": "TypeParameter",
+ "detail": "Json",
+ "sortText": "R",
+ "insertText": "json",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "anydata",
+ "kind": "TypeParameter",
+ "detail": "Anydata",
+ "sortText": "R",
+ "insertText": "anydata",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "any",
+ "kind": "TypeParameter",
+ "detail": "Any",
+ "sortText": "R",
+ "insertText": "any",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "byte",
+ "kind": "TypeParameter",
+ "detail": "Byte",
+ "sortText": "R",
+ "insertText": "byte",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj21.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj21.json
new file mode 100644
index 0000000000..17ca689498
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj21.json
@@ -0,0 +1,771 @@
+{
+ "description": "Function call - person.name.substring(",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.name.substring(",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 22,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "string",
+ "placeholder": "\"\"",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "padStart(int len, string:Char padChar)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nAdds padding to the start of a string.\nAdds sufficient `padChar` characters at the start of `str` to make its length be `len`.\nIf the length of `str` is >= `len`, returns `str`.\n\n```ballerina\n\"100Km\".padStart(10) ⇒ 100Km\n\"100Km\".padStart(10, \"0\") ⇒ 00000100Km\n```\n \n**Params** \n- `int` len: the length of the string to be returned \n- `string:Char` padChar: the character to use for padding `str`; defaults to a space character(Defaultable) \n \n**Return** `string` \n- `str` padded with `padChar` \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "padStart",
+ "insertText": "padStart(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "includesMatch(string:RegExp re, int startIndex)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether there is a match of a regular expression somewhere within a string.\nThis is equivalent to `regexp:find(re, str, startIndex) != ()`.\n\n```ballerina\n\"This will match\".includesMatch(re `Th.*ch`) ⇒ true\n\"Will this match\".includesMatch(re `th.*ch`, 5) ⇒ true\n\"Not a match\".includesMatch(re `Th.*ch`) ⇒ false\n\"Will this match\".includesMatch(re `Th.*ch`, 5) ⇒ false\n```\n \n**Params** \n- `string:RegExp` re: the regular expression \n- `int` startIndex(Defaultable) \n \n**Return** `boolean` \n- true if the is a match of `re` somewhere within `str`, otherwise false \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "includesMatch",
+ "insertText": "includesMatch(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "getCodePoint(int index)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nReturns the code point of a character in a string.\n\n```ballerina\n\"Hello, World!\".getCodePoint(3) ⇒ 108\n```\n \n**Params** \n- `int` index: an index in parameter `str` \n \n**Return** `int` \n- the Unicode code point of the character at parameter `index` in parameter `str` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "getCodePoint",
+ "insertText": "getCodePoint(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBytes()",
+ "kind": "Function",
+ "detail": "byte[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nRepresents a string as an array of bytes using UTF-8.\n\n```ballerina\n\"Hello, World!\".toBytes() ⇒ [72,101,108,108,111,44,32,87,111,114,108,100,33]\n```\n \n \n \n**Return** `byte[]` \n- UTF-8 byte array \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "toBytes",
+ "insertText": "toBytes()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "length()",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nReturns the length of the string.\n\n```ballerina\n\"Hello, World!\".length() ⇒ 13;\n```\n \n \n \n**Return** `int` \n- the number of characters (code points) in parameter `str` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "length",
+ "insertText": "length()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "toCodePointInts()",
+ "kind": "Function",
+ "detail": "int[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nConverts a string to an array of code points.\n\n```ballerina\n\"Hello, world 🌎\".toCodePointInts() ⇒ [72,101,108,108,111,44,32,119,111,114,108,100,32,127758]\n```\n \n \n \n**Return** `int[]` \n- an array with a code point for each character of parameter `str` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "toCodePointInts",
+ "insertText": "toCodePointInts()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "includes(string substr, int startIndex)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether a string includes another string.\n\n```ballerina\n\"Hello World, from Ballerina\".includes(\"Bal\") ⇒ true\n\"Hello World! from Ballerina\".includes(\"Hello\", 10) ⇒ false\n```\n \n**Params** \n- `string` substr: the string to search for \n- `int` startIndex: index to start searching from(Defaultable) \n \n**Return** `boolean` \n- `true` if there is an occurrence of parameter `substr` in parameter `str` at an index >= parameter `startIndex`, \nor `false` otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "includes",
+ "insertText": "includes(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "concat(string... strs)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nConcatenates zero or more strings.\n\n```ballerina\n\"http://worldtimeapi.org\".concat(\"/api/timezone/\", \"Asia\", \"/\", \"Colombo\") ⇒ http://worldtimeapi.org/api/timezone/Asia/Colombo\n// Alternative approach to achieve the same.\nstring:concat(\"http://worldtimeapi.org\", \"/api/timezone/\", \"Asia\", \"/\", \"Colombo\") ⇒ http://worldtimeapi.org/api/timezone/Asia/Colombo\n```\n \n \n \n**Return** `string` \n- concatenation of all of the parameter `strs`; empty string if parameter `strs` is empty \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "concat",
+ "insertText": "concat(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "equalsIgnoreCaseAscii(string str2)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether two strings are the same, ignoring the case of ASCII characters.\n\nA character in the range a-z is treated the same as the corresponding character in the range A-Z.\n\n```ballerina\n\"BALLERINA\".equalsIgnoreCaseAscii(\"ballerina\") ⇒ true\n```\n \n**Params** \n- `string` str2: the second string to be compared \n \n**Return** `boolean` \n- true if parameter `str1` is the same as parameter `str2`, treating upper-case and lower-case \nASCII letters as the same; false, otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "equalsIgnoreCaseAscii",
+ "insertText": "equalsIgnoreCaseAscii(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toUpperAscii()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nConverts occurrences of a-z to A-Z.\n\nOther characters are left unchanged.\n\n```ballerina\n\"hello, World!\".toUpperAscii() ⇒ HELLO, WORLD!\n```\n \n \n \n**Return** `string` \n- parameter `str` with any occurrences of a-z converted to A-Z \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "toUpperAscii",
+ "insertText": "toUpperAscii()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "padEnd(int len, string:Char padChar)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nAdds padding to the end of a string.\nAdds sufficient `padChar` characters to the end of `str` to make its length be `len`.\nIf the length of `str` is >= `len`, returns `str`.\n\n```ballerina\n\"Ballerina for developers\".padEnd(30) ⇒ Ballerina for developers\n\"Ballerina for developers\".padEnd(30, \"!\") ⇒ Ballerina for developers!!!!!!\n```\n \n**Params** \n- `int` len: the length of the string to be returned \n- `string:Char` padChar: the character to use for padding `str`; defaults to a space character(Defaultable) \n \n**Return** `string` \n- `str` padded with `padChar` \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "padEnd",
+ "insertText": "padEnd(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "matches(string:RegExp re)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether there is a full match of a regular expression with a string.\nA match of a regular expression in a string is a full match if it\nstarts at index 0 and ends at index `n`, where `n` is the length of the string.\nThis is equivalent to `regex:isFullMatch(re, str)`.\n\n```ballerina\n\"This is a Match\".matches(re `A|Th.*ch|^`) ⇒ true\n\"Not a Match\".matches(re `A|Th.*ch|^`) ⇒ false\n```\n \n**Params** \n- `string:RegExp` re: the regular expression \n \n**Return** `boolean` \n- true if there is full match of `re` with `str`, and false otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "matches",
+ "insertText": "matches(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "substring(int startIndex, int endIndex)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nReturns a substring of a string.\n\n```ballerina\n\"Hello, my name is John\".substring(7) ⇒ my name is John\n\"Hello, my name is John Anderson\".substring(18, 22) ⇒ John\n```\n \n**Params** \n- `int` startIndex: the starting index, inclusive \n- `int` endIndex: the ending index, exclusive(Defaultable) \n \n**Return** `string` \n- substring consisting of characters with index >= `startIndex` and < `endIndex` \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "substring",
+ "insertText": "substring(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "padZero(int len, string:Char zeroChar)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nPads a string with zeros.\nThe zeros are added at the start of the string, after a `+` or `-` sign if there is one.\nSufficient zero characters are added to `str` to make its length be `len`.\nIf the length of `str` is >= `len`, returns `str`.\n\n```ballerina\n\"-256\".padZero(9) ⇒ -00000256\n\"-880\".padZero(8, \"#\") ⇒ -####880\n```\n \n**Params** \n- `int` len: the length of the string to be returned \n- `string:Char` zeroChar: the character to use for the zero; defaults to ASCII zero `0`(Defaultable) \n \n**Return** `string` \n- `str` padded with zeros \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "padZero",
+ "insertText": "padZero(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "lastIndexOf(string substr, int startIndex)",
+ "kind": "Function",
+ "detail": "int?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nFinds the last occurrence of one string in another string.\n\n```ballerina\n\"Ballerinalang is a unique programming language\".lastIndexOf(\"lang\") ⇒ 38\n// Search backwards for the last occurrence of a string from a specific index.\n\"Ballerinalang is a unique programming language\".lastIndexOf(\"lang\", 15) ⇒ 9\n```\n \n**Params** \n- `string` substr: the string to search for \n- `int` startIndex: index to start searching backwards from(Defaultable) \n \n**Return** `int?` \n- index of the last occurrence of parameter `substr` in parameter `str` that is <= parameter `startIndex`, \nor `()` if there is no such occurrence \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "lastIndexOf",
+ "insertText": "lastIndexOf(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "iterator()",
+ "kind": "Function",
+ "detail": "object {public isolated function next() returns record {|string:Char value;|}?;}",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nReturns an iterator over the string.\n\nThe iterator will yield the substrings of length 1 in order.\n\n```ballerina\nobject {\n public isolated function next() returns record {|string:Char value;|}?;\n} iterator = \"Hello, World!\".iterator();\niterator.next() ⇒ {\"value\":\"H\"}\n```\n \n \n \n**Return** `object {public isolated function next() returns record {|string:Char value;|}?;}` \n- a new iterator object \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "iterator",
+ "insertText": "iterator()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "trim()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nRemoves ASCII white space characters from the start and end of a string.\n\nThe ASCII white space characters are 0x9...0xD, 0x20.\n\n```ballerina\n\" Hello World \".trim() + \"!\" ⇒ Hello World!\n```\n \n \n \n**Return** `string` \n- parameter `str` with leading or trailing ASCII white space characters removed \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "trim",
+ "insertText": "trim()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "endsWith(string substr)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether a string ends with another string.\n\n```ballerina\n\"Welcome to the Ballerina programming language\".endsWith(\"language\") ⇒ true\n```\n \n**Params** \n- `string` substr: the ending string \n \n**Return** `boolean` \n- true if parameter `str` ends with parameter `substr`; false otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "endsWith",
+ "insertText": "endsWith(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "'join(string... strs)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nJoins zero or more strings together with a separator.\n\n```ballerina\nstring:'join(\" \", \"Ballerina\", \"is\", \"a\", \"programming\", \"language\") ⇒ Ballerina is a programming language\nstring[] array = [\"John\", \"23\", \"USA\", \"Computer Science\", \"Swimmer\"];\nstring:'join(\",\", ...array) ⇒ John,23,USA,Computer Science,Swimmer\n```\n \n**Params** \n- `string[]` strs: strings to be joined \n \n**Return** `string` \n- a string consisting of all of parameter `strs` concatenated in order \nwith parameter `separator` in between them \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "'join",
+ "insertText": "'join(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "indexOf(string substr, int startIndex)",
+ "kind": "Function",
+ "detail": "int?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nFinds the first occurrence of one string in another string.\n\n```ballerina\n\"New Zealand\".indexOf(\"land\") ⇒ 7\n\"Ballerinalang is a unique programming language\".indexOf(\"lang\", 15) ⇒ 38\n```\n \n**Params** \n- `string` substr: the string to search for \n- `int` startIndex: index to start searching from(Defaultable) \n \n**Return** `int?` \n- index of the first occurrence of parameter `substr` in parameter `str` that is >= parameter `startIndex`, \nor `()` if there is no such occurrence \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "indexOf",
+ "insertText": "indexOf(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "codePointCompare(string str2)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nLexicographically compares strings using their Unicode code points.\n\nThis orders strings in a consistent and well-defined way,\nbut the ordering will often not be consistent with cultural expectations\nfor sorted order.\n\n```ballerina\n\"Austria\".codePointCompare(\"Australia\") ⇒ 1\n```\n \n**Params** \n- `string` str2: the second string to be compared \n \n**Return** `int` \n- an int that is less than, equal to or greater than zero, \naccording as parameter `str1` is less than, equal to or greater than parameter `str2` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "codePointCompare",
+ "insertText": "codePointCompare(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toLowerAscii()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nConverts occurrences of A-Z to a-z.\n\nOther characters are left unchanged.\n\n```ballerina\n\"HELLO, World!\".toLowerAscii() ⇒ hello, world!\n```\n \n \n \n**Return** `string` \n- parameter `str` with any occurrences of A-Z converted to a-z \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "toLowerAscii",
+ "insertText": "toLowerAscii()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "startsWith(string substr)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.string:0.0.0_ \n \nTests whether a string starts with another string.\n\n```ballerina\n\"Welcome to the Ballerina programming language\".startsWith(\"Welcome\") ⇒ true\n```\n \n**Params** \n- `string` substr: the starting string \n \n**Return** `boolean` \n- true if parameter `str` starts with parameter `substr`; false otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "startsWith",
+ "insertText": "startsWith(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConstructs a value with a specified type by cloning another value.\n\nWhen parameter `v` is a structural value, the inherent type of the value to be constructed\ncomes from parameter `t`. When parameter `t` is a union, it must be possible to determine which\nmember of the union to use for the inherent type by following the same rules\nthat are used by list constructor expressions and mapping constructor expressions\nwith the contextually expected type. If not, then an error is returned.\nThe `cloneWithType` operation is recursively applied to each member of parameter `v` using\nthe type descriptor that the inherent type requires for that member.\n\nLike the Clone abstract operation, this does a deep copy, but differs in\nthe following respects:\n- the inherent type of any structural values constructed comes from the specified\ntype descriptor rather than the value being constructed\n- the read-only bit of values and fields comes from the specified type descriptor\n- the graph structure of `v` is not preserved; the result will always be a tree;\nan error will be returned if `v` has cycles\n- immutable structural values are copied rather being returned as is; all\nstructural values in the result will be mutable.\n- numeric values can be converted using the NumericConvert abstract operation\n- if a record type descriptor specifies default values, these will be used\nto supply any missing members\n\n```ballerina\nanydata[] arr = [1, 2, 3, 4];\nint[] intArray = check arr.cloneWithType();\nintArray ⇒ [1,2,3,4]\narr === intArray ⇒ false\ntype Vowels string:Char[];\nstring[] vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.cloneWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.cloneWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: the type for the cloned to be constructed(Defaultable) \n \n**Return** `t|error` \n- a new value that belongs to parameter `t`, or an error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "cloneWithType",
+ "insertText": "cloneWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "fromJsonString()",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nParses a string in JSON format and returns the value that it represents.\n\nNumbers in the JSON string are converted into Ballerina values of type\ndecimal except in the following two cases:\nif the JSON number starts with `-` and is numerically equal to zero, then it is\nconverted into float value of `-0.0`;\notherwise, if the JSON number is syntactically an integer and is in the range representable\nby a Ballerina int, then it is converted into a Ballerina int.\nA JSON number is considered syntactically an integer if it contains neither\na decimal point nor an exponent.\n\nReturns an error if the string cannot be parsed.\n\n```ballerina\n\"{\\\"id\\\": 12, \\\"name\\\": \\\"John\\\"}\".fromJsonString() ⇒ {\"id\":12,\"name\":\"John\"}\n\"{12: 12}\".fromJsonString() ⇒ error\n```\n \n \n \n**Return** `json|error` \n- `str` parsed to json or error \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "fromJsonString",
+ "insertText": "fromJsonString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromBalString()",
+ "kind": "Function",
+ "detail": "anydata|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nParses and evaluates a subset of Ballerina expression syntax.\n\nThe subset of Ballerina expression syntax supported is that produced\nby toBalString when applied to an anydata value.\n\n```ballerina\nstring a = \"12.12d\";\na.fromBalString() ⇒ 12.12\nstring b = \"[1, 2, !]\";\nb.fromBalString() ⇒ error\n```\n \n \n \n**Return** `anydata|error` \n- the result of evaluating the parsed expression, or \nan error if the string cannot be parsed \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "fromBalString",
+ "insertText": "fromBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonFloatString()",
+ "kind": "Function",
+ "detail": "value:JsonFloat|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nParses a string in JSON format, using float to represent numbers.\n\nReturns an error if the string cannot be parsed.\n\n```ballerina\n\"[12, true, 123.4, \\\"hello\\\"]\".fromJsonFloatString() ⇒ [12.0,true,123.4,\"hello\"]\n\"[12, true, 12.5, !]\".fromJsonFloatString() ⇒ error\n```\n \n \n \n**Return** `value:JsonFloat|error` \n- parameter `str` parsed to JsonFloat or error \n \n"
+ }
+ },
+ "sortText": "BA",
+ "filterText": "fromJsonFloatString",
+ "insertText": "fromJsonFloatString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "last(value:Type... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the last argument.\n\n```ballerina\nvalue:last(1, 2, 3) ⇒ 3\n```\n \n**Params** \n- `value:Type[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- last argument \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "last",
+ "insertText": "last(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "fromJsonDecimalString()",
+ "kind": "Function",
+ "detail": "value:JsonDecimal|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nParses a string in JSON format, using decimal to represent numbers.\n\nReturns an error if the string cannot be parsed.\n\n```ballerina\n\"[12, true, 123.4, \\\"hello\\\"]\".fromJsonDecimalString() ⇒ [12.0,true,123.4,\"hello\"]\n\"[12, true, 12.5, !]\".fromJsonDecimalString() ⇒ error\n```\n \n \n \n**Return** `value:JsonDecimal|error` \n- parameter `str` parsed to JsonDecimal or error \n \n"
+ }
+ },
+ "sortText": "BA",
+ "filterText": "fromJsonDecimalString",
+ "insertText": "fromJsonDecimalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "cloneReadOnly()",
+ "kind": "Function",
+ "detail": "value:CloneableType & readonly",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value that is read-only, i.e., immutable.\n\nIt corresponds to the ImmutableClone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] & readonly immutableClone = arr.cloneReadOnly();\nimmutableClone ⇒ [1,2,3,4]\nimmutableClone is readonly ⇒ true \n```\n \n \n \n**Return** `value:CloneableType & readonly` \n- immutable clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "cloneReadOnly",
+ "insertText": "cloneReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "count(any|error... vs)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the number of arguments.\n\n```ballerina\nvalue:count(1, 2, 3) ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of arguments \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "count",
+ "insertText": "count(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBalString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value to a string that describes the value in Ballerina syntax.\n\nIf parameter `v` is anydata and does not have cycles, then the result will\nconform to the grammar for a Ballerina expression and when evaluated\nwill result in a value that is == to parameter `v`.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the expression style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toBalString() ⇒ 12.12d\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toBalString() ⇒ [1,\"Sam\",12.3,12.12d,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "toBalString",
+ "insertText": "toBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonStringWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a string in JSON format to a user-specified type.\n\nThis is a combination of function `fromJsonString` followed by function `fromJsonWithType`.\n\n```ballerina\nint[] intArray = check \"[1, 2, 3, 4]\".fromJsonStringWithType(); \nintArray ⇒ [1,2,3,4]\n\"2022\".fromJsonStringWithType(int) ⇒ 2022\n\"2022\".fromJsonStringWithType(boolean) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "fromJsonStringWithType",
+ "insertText": "fromJsonStringWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJson()",
+ "kind": "Function",
+ "detail": "json",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type `anydata` to `json`.\n\nThis does a deep copy of parameter `v` converting values that do\nnot belong to json into values that do.\nA value of type `xml` is converted into a string as if\nby the `toString` function.\nA value of type `table` is converted into a list of\nmappings one for each row.\nThe inherent type of arrays in the return value will be\n`json[]` and of mappings will be `map`.\nA new copy is made of all structural values, including\nimmutable values.\nThis panics if parameter `v` has cycles.\n\n```ballerina\nanydata student = {name: \"Jo\", age: 11};\nstudent.toJson() ⇒ {\"name\":\"Jo\",\"age\":11}\nanydata[] array = [];\narray.push(array);\narray.toJson() ⇒ panic\n```\n \n \n \n**Return** `json` \n- representation of `v` as value of type json \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "toJson",
+ "insertText": "toJson()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isReadOnly()",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nTests whether a value is read-only, i.e., immutable.\n\nReturns true if read-only, false otherwise.\n\n```ballerina\nint[] scores = [21, 12, 33, 45, 81];\nscores.isReadOnly() ⇒ true\nstring[] sports = [\"cricket\", \"football\", \"rugby\"];\nsports.isReadOnly() ⇒ false\n```\n \n \n \n**Return** `boolean` \n- true if read-only, false otherwise \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "isReadOnly",
+ "insertText": "isReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type json to a user-specified type.\n\nThis works the same as function `cloneWithType`,\nexcept that it also does the inverse of the conversions done by `toJson`.\n\n```ballerina\njson arr = [1, 2, 3, 4];\nint[] intArray = check arr.fromJsonWithType();\nintArray ⇒ [1,2,3,4]\ntype Vowels string:Char[];\njson vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.fromJsonWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.fromJsonWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "fromJsonWithType",
+ "insertText": "fromJsonWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "mergeJson(json j2)",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nMerges two `json` values.\n\nThe merge of parameter `j1` with parameter `j2` is defined as follows:\n- if parameter `j1` is `()`, then the result is parameter `j2`\n- if parameter `j2` is `()`, then the result is parameter `j1`\n- if parameter `j1` is a mapping and parameter `j2` is a mapping, then for each entry [k, j] in parameter `j2`, set `j1[k]` to the merge of `j1[k]` with `j`\n- if `j1[k]` is undefined, then set `j1[k]` to `j`\n- if any merge fails, then the merge of parameter `j1` with parameter `j2` fails\n- otherwise, the result is parameter `j1`.\n- otherwise, the merge fails\nIf the merge fails, then parameter `j1` is unchanged.\n\n```ballerina\njson student = {name: \"John\", age: 23};\njson location = {city: \"Colombo\", country: \"Sri Lanka\"};\nstudent.mergeJson(location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\nvalue:mergeJson(student, location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\njson city = \"Colombo\";\nstudent.mergeJson(city) ⇒ error\n```\n \n**Params** \n- `json` j2: json value \n \n**Return** `json|error` \n- the merge of parameter `j1` with parameter `j2` or an error if the merge fails \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "mergeJson",
+ "insertText": "mergeJson(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "clone()",
+ "kind": "Function",
+ "detail": "value:CloneableType",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value.\n\nA clone is a deep copy that does not copy immutable subtrees.\nA clone can therefore safely be used concurrently with the original.\nIt corresponds to the Clone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] clone = arr.clone();\nclone ⇒ [1,2,3,4]\narr === clone ⇒ false\n```\n \n \n \n**Return** `value:CloneableType` \n- clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "clone",
+ "insertText": "clone()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "ensureType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nSafely casts a value to a type.\n\nThis casts a value to a type in the same way as a type cast expression,\nbut returns an error if the cast cannot be done, rather than panicking.\n\n```ballerina\njson student = {name: \"Jo\", subjects: [\"CS1212\", \"CS2021\"]};\njson[] subjects = check student.subjects.ensureType();\nsubjects ⇒ [\"CS1212\",\"CS2021\"]\nanydata vowel = \"I\";\nvowel.ensureType(string:Char) ⇒ I;\nvowel.ensureType(int) ⇒ error\n```\n \n**Params** \n- `typedesc` t: a typedesc for the type to which to cast it(Defaultable) \n \n**Return** `t|error` \n- `v` cast to the type described by parameter `t`, or an error, if the cast cannot be done \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "ensureType",
+ "insertText": "ensureType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nPerforms a direct conversion of a value to a string.\n\nThe conversion is direct in the sense that when applied to a value that is already\na string it leaves the value unchanged.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the direct style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toString() ⇒ 12.12\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toString() ⇒ [1,\"Sam\",12.3,12.12,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "toString",
+ "insertText": "toString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "first(any|error... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the first argument.\n\n```ballerina\nvalue:first(1, 2, 3) ⇒ 1\n```\n \n**Params** \n- `(any|error)[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- first argument \n \n"
+ }
+ },
+ "sortText": "CA",
+ "filterText": "first",
+ "insertText": "first(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJsonString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the string that represents a anydata value in JSON format.\n\nparameter `v` is first converted to `json` as if by the function `toJson`.\n\n```ballerina\nanydata marks = {\"Alice\": 90, \"Bob\": 85, \"Jo\": 91};\nmarks.toJsonString() ⇒ {\"Alice\":90, \"Bob\":85, \"Jo\":91}\n```\n \n \n \n**Return** `string` \n- string representation of parameter `v` converted to `json` \n \n"
+ }
+ },
+ "sortText": "AA",
+ "filterText": "toJsonString",
+ "insertText": "toJsonString()",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj22.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj22.json
new file mode 100644
index 0000000000..1f6a4a8a22
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj22.json
@@ -0,0 +1,679 @@
+{
+ "description": "Conditional expression - ternary operator",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.name == \"\" ? admission. : person.",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 31,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "string",
+ "placeholder": "\"\"",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "natural",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "natural",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "decimal",
+ "kind": "TypeParameter",
+ "detail": "Decimal",
+ "sortText": "R",
+ "insertText": "decimal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "error",
+ "kind": "Event",
+ "detail": "Error",
+ "sortText": "P",
+ "insertText": "error",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "object",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "object",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "transaction",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "transaction",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "xml",
+ "kind": "TypeParameter",
+ "detail": "Xml",
+ "sortText": "R",
+ "insertText": "xml",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "table",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "table",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "map",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "map",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "stream",
+ "kind": "Unit",
+ "detail": "type",
+ "sortText": "R",
+ "insertText": "stream",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "boolean",
+ "kind": "TypeParameter",
+ "detail": "Boolean",
+ "sortText": "R",
+ "insertText": "boolean",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "future",
+ "kind": "TypeParameter",
+ "detail": "Future",
+ "sortText": "R",
+ "insertText": "future",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "int",
+ "kind": "TypeParameter",
+ "detail": "Int",
+ "sortText": "R",
+ "insertText": "int",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "float",
+ "kind": "TypeParameter",
+ "detail": "Float",
+ "sortText": "R",
+ "insertText": "float",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "function",
+ "kind": "TypeParameter",
+ "detail": "Function",
+ "sortText": "R",
+ "insertText": "function",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "string",
+ "kind": "TypeParameter",
+ "detail": "String",
+ "sortText": "R",
+ "insertText": "string",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "typedesc",
+ "kind": "TypeParameter",
+ "detail": "Typedesc",
+ "sortText": "R",
+ "insertText": "typedesc",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "service",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "service",
+ "insertText": "service",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "new",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "new",
+ "insertText": "new ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isolated",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "isolated",
+ "insertText": "isolated ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "transactional",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "transactional",
+ "insertText": "transactional",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "function",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "function",
+ "insertText": "function ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "let",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "let",
+ "insertText": "let",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "typeof",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "typeof",
+ "insertText": "typeof ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "trap",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "trap",
+ "insertText": "trap",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "client",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "client",
+ "insertText": "client ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "true",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "true",
+ "insertText": "true",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "false",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "false",
+ "insertText": "false",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "null",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "null",
+ "insertText": "null",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "check",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "check",
+ "insertText": "check ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "checkpanic",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "checkpanic",
+ "insertText": "checkpanic ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "is",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "is",
+ "insertText": "is",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "error constructor",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "error",
+ "insertText": "error(\"${1}\")",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "object constructor",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "object",
+ "insertText": "object {${1}}",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "base16",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "base16",
+ "insertText": "base16 `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "base64",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "base64",
+ "insertText": "base64 `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "from",
+ "kind": "Keyword",
+ "detail": "Keyword",
+ "sortText": "U",
+ "filterText": "from",
+ "insertText": "from ",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "re ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "re ``",
+ "insertText": "re `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "string ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "string ``",
+ "insertText": "string `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "xml ``",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "xml ``",
+ "insertText": "xml `${1}`",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "natural (..) {..}",
+ "kind": "Snippet",
+ "detail": "Snippet",
+ "sortText": "T",
+ "filterText": "natural (..) {..}",
+ "insertText": "natural (${1}) {${2}}",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Address",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Address",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Admission",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Admission",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Employee",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Employee",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Location",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Location",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "MyOk",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "MyOk",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Person",
+ "kind": "Struct",
+ "detail": "Record",
+ "sortText": "Q",
+ "insertText": "Person",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "StrandData",
+ "kind": "Struct",
+ "detail": "Record",
+ "documentation": {
+ "left": "Describes Strand execution details for the runtime.\n"
+ },
+ "sortText": "Q",
+ "insertText": "StrandData",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "Thread",
+ "kind": "TypeParameter",
+ "detail": "Union",
+ "sortText": "R",
+ "insertText": "Thread",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "add(int a, int b)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nAdds two integers and returns the result.\n\n```\nint result = add(5, 3);\n// result will be 8\n``` \n**Params** \n- `int` a: The first integer to be added \n- `int` b: The second integer to be added\n \n \n**Return** `int` \n- The sum of the two integers \n \n# Example \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "add",
+ "insertText": "add(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "admission",
+ "kind": "Variable",
+ "detail": "Admission",
+ "sortText": "F",
+ "insertText": "admission",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "firstVal",
+ "kind": "Variable",
+ "detail": "\"first\"",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": ""
+ }
+ },
+ "sortText": "AB",
+ "insertText": "firstVal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "greet(string name)",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `string` name \n \n**Return** `string` \n \n"
+ }
+ },
+ "sortText": "AC",
+ "filterText": "greet",
+ "insertText": "greet(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "main()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n"
+ }
+ },
+ "sortText": "ZD",
+ "filterText": "main",
+ "insertText": "main()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "person",
+ "kind": "Variable",
+ "detail": "Person",
+ "sortText": "F",
+ "insertText": "person",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "prefixSum(int[] numbers)",
+ "kind": "Function",
+ "detail": "int[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nComputes the prefix sum of an array of integers.\n\nThe prefix sum of an array is a new array where each element at index `i` is the sum of the elements\nfrom the start of the array up to index `i`.\n \n**Params** \n- `int[]` numbers: The array of integers for which the prefix sum is to be computed. \n \n**Return** `int[]` \n- An array of integers representing the prefix sum of the input array. \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "prefixSum",
+ "insertText": "prefixSum(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "safeDivide(float a, float b)",
+ "kind": "Function",
+ "detail": "float|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \nPerforms a safe division operation.\n\nThis function divides the given numerator by the denominator and returns the result.\nIf the denominator is zero, it returns an error indicating a division by zero.\n \n**Params** \n- `float` a: The numerator of type `float`. \n- `float` b: The denominator of type `float`.\n\n# Returns\n- `float` - The result of the division if the denominator is not zero.\n- `error` - An error indicating division by zero if the denominator is zero.\n \n \n**Return** `float|error` \n- The result of the division or an error. \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "safeDivide",
+ "insertText": "safeDivide(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "secondVal",
+ "kind": "Variable",
+ "detail": "string",
+ "sortText": "AB",
+ "insertText": "secondVal",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "sum(int... numbers)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `int[]` numbers \n \n**Return** `int` \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "sum",
+ "insertText": "sum(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "transform(Person person, Admission admission)",
+ "kind": "Function",
+ "detail": "Employee",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _nipunaf/proj:0.1.0_ \n \n \n**Params** \n- `Person` person \n- `Admission` admission \n \n**Return** `Employee` \n \n"
+ }
+ },
+ "sortText": "G",
+ "filterText": "transform",
+ "insertText": "transform(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "readonly",
+ "kind": "TypeParameter",
+ "detail": "Readonly",
+ "sortText": "R",
+ "insertText": "readonly",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "handle",
+ "kind": "TypeParameter",
+ "detail": "Handle",
+ "sortText": "R",
+ "insertText": "handle",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "never",
+ "kind": "TypeParameter",
+ "detail": "Never",
+ "sortText": "R",
+ "insertText": "never",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "json",
+ "kind": "TypeParameter",
+ "detail": "Json",
+ "sortText": "R",
+ "insertText": "json",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "anydata",
+ "kind": "TypeParameter",
+ "detail": "Anydata",
+ "sortText": "R",
+ "insertText": "anydata",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "any",
+ "kind": "TypeParameter",
+ "detail": "Any",
+ "sortText": "R",
+ "insertText": "any",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "byte",
+ "kind": "TypeParameter",
+ "detail": "Byte",
+ "sortText": "R",
+ "insertText": "byte",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj23.json b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj23.json
new file mode 100644
index 0000000000..23bedb72b7
--- /dev/null
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/config/proj23.json
@@ -0,0 +1,549 @@
+{
+ "description": "Type constraint filter - person. with int constraint",
+ "filePath": "proj/data_mapper.bal",
+ "context": {
+ "expression": "person.",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "offset": 7,
+ "lineOffset": 0,
+ "codedata": {
+ "lineRange": {
+ "fileName": "data_mappings.bal",
+ "startLine": {
+ "line": 1,
+ "offset": 0
+ },
+ "endLine": {
+ "line": 9,
+ "offset": 2
+ }
+ },
+ "node": "DATA_MAPPER_DEFINITION",
+ "id": 1569
+ },
+ "property": {
+ "metadata": {
+ "label": "Variable",
+ "description": "Name of the variable/field"
+ },
+ "valueType": "DATA_MAPPING_EXPRESSION",
+ "valueTypeConstraint": "int",
+ "placeholder": "0",
+ "optional": false,
+ "editable": true,
+ "advanced": false
+ }
+ },
+ "completionContext": {
+ "triggerKind": "Invoked"
+ },
+ "completions": [
+ {
+ "label": "name",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "CA",
+ "insertText": "name",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "email",
+ "kind": "Field",
+ "detail": "string",
+ "sortText": "CA",
+ "insertText": "email",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "address",
+ "kind": "Field",
+ "detail": "Address",
+ "sortText": "CA",
+ "insertText": "address",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "reduce(function (map:Type1 accum, map:Type val) returns map:Type1 func, map:Type1 initial)",
+ "kind": "Function",
+ "detail": "map:Type1",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nCombines the members of a map using a combining function.\n\nThe combining function takes the combined value so far and a member of the map,\nand returns a new combined value.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.reduce(isolated function (int total, int next) returns int => total + next, 0) ⇒ 195\n```\n \n**Params** \n- `function (map:Type1 accum, map:Type val) returns map:Type1` func: combining function \n- `map:Type1` initial: initial value for the first argument of combining parameter `func` \n \n**Return** `map:Type1` \n- result of combining the members of parameter `m` using parameter `func` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "reduce",
+ "insertText": "reduce(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "hasKey(string k)",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nTests whether a map value has a member with a given key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.hasKey(\"Carl\") ⇒ true\nmarks.hasKey(\"John\") ⇒ false\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `boolean` \n- true if parameter `m` has a member with key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "hasKey",
+ "insertText": "hasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "forEach(function (map:Type val) returns () func)",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function to each member of a map.\n\nThe parameter `func` is applied to each member of parameter `m`.\n\n```ballerina\nint total = 0;\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.forEach(function (int m) {\n total += m;\n});\ntotal ⇒ 195\n```\n \n**Params** \n- `function (map:Type val) returns ()` func: a function to apply to each member"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "forEach",
+ "insertText": "forEach(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "keys()",
+ "kind": "Function",
+ "detail": "string[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the keys of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.keys() ⇒ [\"Carl\",\"Bob\",\"Max\"]\n```\n \n \n \n**Return** `string[]` \n- a new list of all keys \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "keys",
+ "insertText": "keys()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "length()",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns number of members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.length() ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of members in parameter `m` \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "length",
+ "insertText": "length()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "remove(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map.\n\nThis removes the member of parameter `m` with key parameter `k` and returns it.\nIt panics if there is no such member.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.remove(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.remove(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- the member of parameter `m` that had key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "remove",
+ "insertText": "remove(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "filter(function (map:Type val) returns boolean func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nSelects the members from a map for which a function returns true.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.filter(m => m >= 60) ⇒ {\"Carl\":85,\"Max\":60}\n```\n \n**Params** \n- `function (map:Type val) returns boolean` func: a predicate to apply to each element to test whether it should be included \n \n**Return** `map` \n- new map containing members for which parameter `func` evaluates to true \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "filter",
+ "insertText": "filter(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "removeIfHasKey(string k)",
+ "kind": "Function",
+ "detail": "map:Type?",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves a member of a map with a given key, if the map has member with the key.\n\nIf parameter `m` has a member with key parameter `k`, it removes and returns it;\notherwise it returns `()`.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeIfHasKey(\"Carl\") ⇒ 85\nmarks ⇒ {\"Bob\":50,\"Max\":60}\nmarks.removeIfHasKey(\"John\") is () ⇒ true\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type?` \n- the member of parameter `m` that had key parameter `k`, or `()` if parameter `m` does not have a key parameter `k` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeIfHasKey",
+ "insertText": "removeIfHasKey(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "iterator()",
+ "kind": "Function",
+ "detail": "object {public isolated function next() returns record {|map:Type value;|}?;}",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns an iterator over a map.\n\nThe iterator will iterate over the members of the map not the keys.\nThe function `entries` can be used to iterate over the keys and members together.\nThe function `keys` can be used to iterator over just the keys.\n\n```ballerina\nobject {\n public isolated function next() returns record {|int value;|}?;\n} iterator = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.iterator();\niterator.next() ⇒ {\"value\":85}\n```\n \n \n \n**Return** `object {public isolated function next() returns record {|map:Type value;|}?;}` \n- a new iterator object that will iterate over the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "iterator",
+ "insertText": "iterator()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "entries()",
+ "kind": "Function",
+ "detail": "map<[string, map:Type]>",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a map containing [key, member] pair as the value for each key.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50}.entries() ⇒ {\"Carl\":[\"Carl\",85],\"Bob\":[\"Bob\",50]}\n```\n \n \n \n**Return** `map<[string, map:Type]>` \n- a new map of [key, member] pairs \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "entries",
+ "insertText": "entries()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "removeAll()",
+ "kind": "Function",
+ "detail": "()",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nRemoves all members of a map.\n\nThis panics if any member cannot be removed.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.removeAll();\nmarks ⇒ {}\nmap values = {x: 10, y: 20};\nvalues.removeAll() ⇒ panic;\n```\n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "removeAll",
+ "insertText": "removeAll()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "get(string k)",
+ "kind": "Function",
+ "detail": "map:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns the member of a map with given key.\n\nThis for use in a case where it is known that the map has a specific key,\nand accordingly panics if parameter `m` does not have a member with parameter `k` key.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.get(\"Carl\") ⇒ 85\nmarks.get(\"John\") ⇒ panic\n```\n \n**Params** \n- `string` k: the key \n \n**Return** `map:Type` \n- member with parameter `k` key \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "get",
+ "insertText": "get(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toArray()",
+ "kind": "Function",
+ "detail": "map:Type[]",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nReturns a list of all the members of a map.\n\n```ballerina\n{\"Carl\": 85, \"Bob\": 50, \"Max\": 60}.toArray() ⇒ [85,50,60]\n```\n \n \n \n**Return** `map:Type[]` \n- an array whose members are the members of parameter `m` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toArray",
+ "insertText": "toArray()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "'map(function (map:Type val) returns map:Type1 func)",
+ "kind": "Function",
+ "detail": "map",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.map:0.0.0_ \n \nApplies a function each member of a map and returns a map of the result.\n\nThe resulting map will have the same keys as the argument map.\n\n```ballerina\nmap marks = {\"Carl\": 85, \"Bob\": 50, \"Max\": 60};\nmarks.map(m => m > 50) ⇒ {\"Carl\":true,\"Bob\":false,\"Max\":true}\n```\n \n**Params** \n- `function (map:Type val) returns map:Type1` func: a function to apply to each member \n \n**Return** `map` \n- new map containing result of applying parameter `func` to each member \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "'map",
+ "insertText": "'map(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConstructs a value with a specified type by cloning another value.\n\nWhen parameter `v` is a structural value, the inherent type of the value to be constructed\ncomes from parameter `t`. When parameter `t` is a union, it must be possible to determine which\nmember of the union to use for the inherent type by following the same rules\nthat are used by list constructor expressions and mapping constructor expressions\nwith the contextually expected type. If not, then an error is returned.\nThe `cloneWithType` operation is recursively applied to each member of parameter `v` using\nthe type descriptor that the inherent type requires for that member.\n\nLike the Clone abstract operation, this does a deep copy, but differs in\nthe following respects:\n- the inherent type of any structural values constructed comes from the specified\ntype descriptor rather than the value being constructed\n- the read-only bit of values and fields comes from the specified type descriptor\n- the graph structure of `v` is not preserved; the result will always be a tree;\nan error will be returned if `v` has cycles\n- immutable structural values are copied rather being returned as is; all\nstructural values in the result will be mutable.\n- numeric values can be converted using the NumericConvert abstract operation\n- if a record type descriptor specifies default values, these will be used\nto supply any missing members\n\n```ballerina\nanydata[] arr = [1, 2, 3, 4];\nint[] intArray = check arr.cloneWithType();\nintArray ⇒ [1,2,3,4]\narr === intArray ⇒ false\ntype Vowels string:Char[];\nstring[] vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.cloneWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.cloneWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: the type for the cloned to be constructed(Defaultable) \n \n**Return** `t|error` \n- a new value that belongs to parameter `t`, or an error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneWithType",
+ "insertText": "cloneWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "last(value:Type... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the last argument.\n\n```ballerina\nvalue:last(1, 2, 3) ⇒ 3\n```\n \n**Params** \n- `value:Type[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- last argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "last",
+ "insertText": "last(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "cloneReadOnly()",
+ "kind": "Function",
+ "detail": "value:CloneableType & readonly",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value that is read-only, i.e., immutable.\n\nIt corresponds to the ImmutableClone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] & readonly immutableClone = arr.cloneReadOnly();\nimmutableClone ⇒ [1,2,3,4]\nimmutableClone is readonly ⇒ true \n```\n \n \n \n**Return** `value:CloneableType & readonly` \n- immutable clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "cloneReadOnly",
+ "insertText": "cloneReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "count(any|error... vs)",
+ "kind": "Function",
+ "detail": "int",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the number of arguments.\n\n```ballerina\nvalue:count(1, 2, 3) ⇒ 3\n```\n \n \n \n**Return** `int` \n- number of arguments \n \n"
+ }
+ },
+ "sortText": "AD",
+ "filterText": "count",
+ "insertText": "count(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toBalString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value to a string that describes the value in Ballerina syntax.\n\nIf parameter `v` is anydata and does not have cycles, then the result will\nconform to the grammar for a Ballerina expression and when evaluated\nwill result in a value that is == to parameter `v`.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the expression style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toBalString() ⇒ 12.12d\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toBalString() ⇒ [1,\"Sam\",12.3,12.12d,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toBalString",
+ "insertText": "toBalString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "toJson()",
+ "kind": "Function",
+ "detail": "json",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type `anydata` to `json`.\n\nThis does a deep copy of parameter `v` converting values that do\nnot belong to json into values that do.\nA value of type `xml` is converted into a string as if\nby the `toString` function.\nA value of type `table` is converted into a list of\nmappings one for each row.\nThe inherent type of arrays in the return value will be\n`json[]` and of mappings will be `map`.\nA new copy is made of all structural values, including\nimmutable values.\nThis panics if parameter `v` has cycles.\n\n```ballerina\nanydata student = {name: \"Jo\", age: 11};\nstudent.toJson() ⇒ {\"name\":\"Jo\",\"age\":11}\nanydata[] array = [];\narray.push(array);\narray.toJson() ⇒ panic\n```\n \n \n \n**Return** `json` \n- representation of `v` as value of type json \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toJson",
+ "insertText": "toJson()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "isReadOnly()",
+ "kind": "Function",
+ "detail": "boolean",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nTests whether a value is read-only, i.e., immutable.\n\nReturns true if read-only, false otherwise.\n\n```ballerina\nint[] scores = [21, 12, 33, 45, 81];\nscores.isReadOnly() ⇒ true\nstring[] sports = [\"cricket\", \"football\", \"rugby\"];\nsports.isReadOnly() ⇒ false\n```\n \n \n \n**Return** `boolean` \n- true if read-only, false otherwise \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "isReadOnly",
+ "insertText": "isReadOnly()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "fromJsonWithType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nConverts a value of type json to a user-specified type.\n\nThis works the same as function `cloneWithType`,\nexcept that it also does the inverse of the conversions done by `toJson`.\n\n```ballerina\njson arr = [1, 2, 3, 4];\nint[] intArray = check arr.fromJsonWithType();\nintArray ⇒ [1,2,3,4]\ntype Vowels string:Char[];\njson vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"];\nvowels.fromJsonWithType(Vowels) ⇒ [\"a\",\"e\",\"i\",\"o\",\"u\"]\nvowels.fromJsonWithType(string) ⇒ error\n```\n \n**Params** \n- `typedesc` t: type to convert to(Defaultable) \n \n**Return** `t|error` \n- value belonging to type parameter `t` or error if this cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "fromJsonWithType",
+ "insertText": "fromJsonWithType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "mergeJson(json j2)",
+ "kind": "Function",
+ "detail": "json|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nMerges two `json` values.\n\nThe merge of parameter `j1` with parameter `j2` is defined as follows:\n- if parameter `j1` is `()`, then the result is parameter `j2`\n- if parameter `j2` is `()`, then the result is parameter `j1`\n- if parameter `j1` is a mapping and parameter `j2` is a mapping, then for each entry [k, j] in parameter `j2`, set `j1[k]` to the merge of `j1[k]` with `j`\n- if `j1[k]` is undefined, then set `j1[k]` to `j`\n- if any merge fails, then the merge of parameter `j1` with parameter `j2` fails\n- otherwise, the result is parameter `j1`.\n- otherwise, the merge fails\nIf the merge fails, then parameter `j1` is unchanged.\n\n```ballerina\njson student = {name: \"John\", age: 23};\njson location = {city: \"Colombo\", country: \"Sri Lanka\"};\nstudent.mergeJson(location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\nvalue:mergeJson(student, location) ⇒ {\"name\":\"John\",\"age\":23,\"city\":\"Colombo\",\"country\":\"Sri Lanka\"}\njson city = \"Colombo\";\nstudent.mergeJson(city) ⇒ error\n```\n \n**Params** \n- `json` j2: json value \n \n**Return** `json|error` \n- the merge of parameter `j1` with parameter `j2` or an error if the merge fails \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "mergeJson",
+ "insertText": "mergeJson(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "clone()",
+ "kind": "Function",
+ "detail": "value:CloneableType",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns a clone of a value.\n\nA clone is a deep copy that does not copy immutable subtrees.\nA clone can therefore safely be used concurrently with the original.\nIt corresponds to the Clone(v) abstract operation,\ndefined in the Ballerina Language Specification.\n\n```ballerina\nint[] arr = [1, 2, 3, 4];\nint[] clone = arr.clone();\nclone ⇒ [1,2,3,4]\narr === clone ⇒ false\n```\n \n \n \n**Return** `value:CloneableType` \n- clone of parameter `v` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "clone",
+ "insertText": "clone()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "ensureType(typedesc t)",
+ "kind": "Function",
+ "detail": "t|error",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nSafely casts a value to a type.\n\nThis casts a value to a type in the same way as a type cast expression,\nbut returns an error if the cast cannot be done, rather than panicking.\n\n```ballerina\njson student = {name: \"Jo\", subjects: [\"CS1212\", \"CS2021\"]};\njson[] subjects = check student.subjects.ensureType();\nsubjects ⇒ [\"CS1212\",\"CS2021\"]\nanydata vowel = \"I\";\nvowel.ensureType(string:Char) ⇒ I;\nvowel.ensureType(int) ⇒ error\n```\n \n**Params** \n- `typedesc` t: a typedesc for the type to which to cast it(Defaultable) \n \n**Return** `t|error` \n- `v` cast to the type described by parameter `t`, or an error, if the cast cannot be done \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "ensureType",
+ "insertText": "ensureType(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nPerforms a direct conversion of a value to a string.\n\nThe conversion is direct in the sense that when applied to a value that is already\na string it leaves the value unchanged.\n\nThe details of the conversion are specified by the ToString abstract operation\ndefined in the Ballerina Language Specification, using the direct style.\n\n```ballerina\ndecimal value = 12.12d;\nvalue.toString() ⇒ 12.12\nanydata[] data = [1, \"Sam\", 12.3f, 12.12d, {value: 12}];\ndata.toString() ⇒ [1,\"Sam\",12.3,12.12,{\"value\":12}]\n```\n \n \n \n**Return** `string` \n- a string resulting from the conversion \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toString",
+ "insertText": "toString()",
+ "insertTextFormat": "Snippet"
+ },
+ {
+ "label": "first(any|error... vs)",
+ "kind": "Function",
+ "detail": "value:Type",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the first argument.\n\n```ballerina\nvalue:first(1, 2, 3) ⇒ 1\n```\n \n**Params** \n- `(any|error)[]` vs: rest of the arguments \n \n**Return** `value:Type` \n- first argument \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "first",
+ "insertText": "first(${1})",
+ "insertTextFormat": "Snippet",
+ "command": {
+ "title": "editor.action.triggerParameterHints",
+ "command": "editor.action.triggerParameterHints"
+ }
+ },
+ {
+ "label": "toJsonString()",
+ "kind": "Function",
+ "detail": "string",
+ "documentation": {
+ "right": {
+ "kind": "markdown",
+ "value": "**Package:** _ballerina/lang.value:0.0.0_ \n \nReturns the string that represents a anydata value in JSON format.\n\nparameter `v` is first converted to `json` as if by the function `toJson`.\n\n```ballerina\nanydata marks = {\"Alice\": 90, \"Bob\": 85, \"Jo\": 91};\nmarks.toJsonString() ⇒ {\"Alice\":90, \"Bob\":85, \"Jo\":91}\n```\n \n \n \n**Return** `string` \n- string representation of parameter `v` converted to `json` \n \n"
+ }
+ },
+ "sortText": "CD",
+ "filterText": "toJsonString",
+ "insertText": "toJsonString()",
+ "insertTextFormat": "Snippet"
+ }
+ ]
+}
diff --git a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/source/proj/data_mapper.bal b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/source/proj/data_mapper.bal
index 7af6aded6d..d04f1911d1 100644
--- a/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/source/proj/data_mapper.bal
+++ b/flow-model-generator/modules/flow-model-generator-ls-extension/src/test/resources/completions/source/proj/data_mapper.bal
@@ -8,4 +8,3 @@ function transform(Person person, Admission admission) returns Employee => {
country: person.address.country
}
};
-