ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.54k stars 733 forks source link

[2201.9.0] Add the relevant new import text edits via the Create variable with type code action #42623

Closed nipunayf closed 3 weeks ago

nipunayf commented 3 weeks ago

Purpose

It is a mandate of a code action to generate a valid Ballerina source code. However, while the Create variable with type code action produces the correct variable type, it is unable to import the necessary modules. This is addressed via this PR.

2201.9.0 of https://github.com/ballerina-platform/ballerina-lang/pull/42574

Approach

Following a similar approach as seen in the 'Create variable' code action, the PR adjusts the logic of the 'Create variable with type' code action to utilize the same 'ImportAcceptor'.

Samples

https://github.com/ballerina-platform/ballerina-lang/assets/59343084/79cec6fe-fde6-4dd8-a495-c2181d44118c

Check List

nipunayf commented 3 weeks ago

Duplicate of https://github.com/ballerina-platform/ballerina-lang/pull/42608