ballerina-lang
ballerina-lang copied to clipboard
Remove the type from the text generated by the `Extract to constant` code action
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.
- 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.
Check List
- [x] Read the Contributing Guide
- [ ] Updated Change Log
- [ ] Checked Tooling Support (#<Issue Number>)
- [ ] Added necessary tests
- [ ] Unit Tests
- [ ] Spec Conformance Tests
- [ ] Integration Tests
- [ ] Ballerina By Example Tests
- [ ] Increased Test Coverage
- [ ] Added necessary documentation
- [ ] API documentation
- [ ] Module documentation in Module.md files
- [ ] Ballerina By Examples
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.
Codecov Report
Attention: Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
Project coverage is 77.50%. Comparing base (
b45e1e1) to head (cae206e). Report is 25 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...eaction/providers/ExtractToConstantCodeAction.java | 82.35% | 0 Missing and 3 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #42643 +/- ##
============================================
- Coverage 77.51% 77.50% -0.01%
- Complexity 58585 58589 +4
============================================
Files 3438 3438
Lines 219219 219221 +2
Branches 28921 28916 -5
============================================
- Hits 169921 169911 -10
- Misses 39884 39890 +6
- Partials 9414 9420 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.