Open LakshanWeerasinghe opened 5 months ago
This concern is valid for other CAs that produce functions, as the parameter name generation can be isolated to the following method.
Once the arg name is empty, it considers the first letter of the type symbol. This is a valid approach for expression values on which we cannot produce an admissible arg name, such as 1
, arr[0]
, true
, etc. However, for cases such as yours, we can use the last field to determine the arg name. For instance, for the function call fn(rec1.year, rec1.nestedRec.year, rec2.year)
, the function function fn(int year, int year2, int year3) {}
can be generated.
Description
$subject
When we pass a record field to a function invocation that has not been defined yet, the plugin will suggest a
create function code action
. However, when creating the parameters for this function, we are not utilizing the field name. Because of this user most of the time need to rename the function params to have better readability of the code.When suggesting the
create function code action
in such scenarios, we should utilize the field names to define function params.https://github.com/ballerina-platform/ballerina-lang/assets/46857198/0eee2609-5863-4123-bb56-744b03d9c664
Describe your problem(s)
No response
Describe your solution(s)
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response