Having the type symbol is only applicable when the respective declaration requires more readability. Since there is no precise distinction for such cases, it is difficult to write an precise algorithm to handle these cases.
Including such logic would impact the performance slightly.
Hence, it is up to the user to add the type symbol if it is necessary.
Purpose
As described in https://github.com/ballerina-platform/ballerina-dev-website/pull/8884, it is the best practice to opt out using the type symbol when declaring a constant. With this PR, the
Extract to constant
code action is modified to reflect this change.Fixes #42041
Approach
Removed appending the type symbol to the generated text edit.
Samples
https://github.com/ballerina-platform/ballerina-lang/assets/59343084/76b40988-ea47-46d0-af7a-d8fb8c6d9df8
Remarks
In the https://github.com/ballerina-platform/ballerina-dev-website/pull/8884, there are some scenarios in which having the type symbol in the declaration can be beneficial. However, the revised design does not consider those cases due to the following points.
Hence, it is up to the user to add the type symbol if it is necessary.
Check List