Skip to content

Import statements are not being added when creating a configurable from imported type #2024

@axewilledge

Description

@axewilledge

Description

When creating a configurable value from configurable view using a imported type. The import statement is not being added.

Current request and response

[Trace - 16:28:56] Sending request 'configEditorV2/updateConfigVariable - (183)'.
Params: {
    "configFilePath": "/Users/anjanash/projects/Samples/automationtest/config.bal",
    "configVariable": {
        "id": "31",
        "metadata": {
            "label": "Config",
            "description": "Create a configurable variable"
        },
        "codedata": {
            "node": "CONFIG_VARIABLE",
            "isNew": true,
            "lineRange": {
                "startLine": {
                    "line": 0,
                    "offset": 0
                },
                "endLine": {
                    "line": 0,
                    "offset": 0
                }
            }
        },
        "returning": false,
        "properties": {
            "variable": {
                "metadata": {
                    "label": "Variable Name",
                    "description": "Name of the variable"
                },
                "valueType": "IDENTIFIER",
                "valueTypeConstraint": "Global",
                "optional": false,
                "editable": true,
                "advanced": false,
                "hidden": false,
                "modified": false,
                "value": "httpAuth"
            },
            "type": {
                "metadata": {
                    "label": "Variable Type",
                    "description": "Type of the variable"
                },
                "valueType": "TYPE",
                "value": "http:BearerTokenConfig",
                "placeholder": "var",
                "optional": false,
                "editable": true,
                "advanced": false,
                "hidden": false,
                "modified": true,
                "codedata": {},
                "imports": {
                    "http": "ballerina/http:2.14.7"
                }
            },
            "configValue": {
                "metadata": {
                    "label": "Config Value",
                    "description": "Config value of the variable, to be used in Config.toml"
                },
                "valueType": "EXPRESSION",
                "value": "",
                "optional": true,
                "editable": true,
                "advanced": false,
                "hidden": true,
                "modified": false
            },
            "defaultValue": {
                "metadata": {
                    "label": "Default Value",
                    "description": "Default value of the variable"
                },
                "valueType": "EXPRESSION",
                "value": "",
                "optional": true,
                "editable": true,
                "advanced": false,
                "hidden": false,
                "modified": true
            },
            "documentation": {
                "metadata": {
                    "label": "Documentation",
                    "description": "Variable documentation in Markdown format"
                },
                "valueType": "STRING",
                "value": "",
                "optional": true,
                "editable": true,
                "advanced": false,
                "hidden": false,
                "modified": false
            }
        },
        "flags": 0
    },
    "packageName": "anjanash/automationtest",
    "moduleName": ""
}


[Trace - 16:28:56] Received response 'configEditorV2/updateConfigVariable - (183)' in 67ms.
Result: {
    "textEdits": {
        "/Users/anjanash/projects/Samples/automationtest/config.bal": [
            {
                "range": {
                    "start": {
                        "line": 2,
                        "character": 0
                    },
                    "end": {
                        "line": 2,
                        "character": 0
                    }
                },
                "newText": "configurable http:BearerTokenConfig httpAuth = ?;\n"
            }
        ]
    }
}

Steps to Reproduce

  1. Go to configurable view
  2. Add a new config
  3. When selecting the type, browse through the type browser to select a type from a module , Ex: http:BearerTokenConfig
  4. Click save.
  5. The config gets added to the view but without the type definition

Version

1.5.2

Environment Details (with versions)

No response

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions