Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the type from the text generated by the Extract to constant code action #42643

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

nipunayf
Copy link
Contributor

Purpose

As described in ballerina-platform/ballerina-dev-website#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

Screen.Recording.2024-04-26.at.9.46.15.AM.mov

Remarks

In the ballerina-platform/ballerina-dev-website#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.

  1. 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.
  2. 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

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • 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

@nipunayf nipunayf added the Team/LanguageServer Language Server Implementation related issues. #Compiler label Apr 26, 2024
@nipunayf nipunayf changed the title Fix 42041 Removes the type from the text generated by the Extract to constant code action Apr 26, 2024
@nipunayf nipunayf changed the title Removes the type from the text generated by the Extract to constant code action Remove the type from the text generated by the Extract to constant code action Apr 26, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label May 11, 2024
@nipunayf nipunayf removed the Stale label May 12, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label May 27, 2024
@nipunayf nipunayf removed the Stale label May 28, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Jun 12, 2024
@nipunayf nipunayf removed the Stale label Jun 13, 2024
@nipunayf nipunayf added the Area/CodeAction Language Server Code Actions label Jun 26, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Jul 12, 2024
@nipunayf nipunayf removed the Stale label Jul 13, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Jul 28, 2024
@nipunayf nipunayf removed the Stale label Jul 29, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Aug 14, 2024
@nipunayf nipunayf removed the Stale label Aug 14, 2024
Copy link

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.

@github-actions github-actions bot added the Stale label Aug 30, 2024
@nipunayf nipunayf removed the Stale label Aug 31, 2024
Copy link

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.

Copy link

codecov bot commented Sep 17, 2024

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 (d1a2cce) to head (cae206e).
Report is 68 commits behind head on master.

Files with missing lines Patch % Lines
...eaction/providers/ExtractToConstantCodeAction.java 82.35% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #42643      +/-   ##
============================================
- Coverage     77.52%   77.50%   -0.02%     
- Complexity    58588    58589       +1     
============================================
  Files          3438     3438              
  Lines        219218   219221       +3     
  Branches      28921    28916       -5     
============================================
- Hits         169948   169911      -37     
- Misses        39850    39890      +40     
  Partials       9420     9420              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gimantha gimantha merged commit 5a52d89 into ballerina-platform:master Oct 2, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAction Language Server Code Actions Team/LanguageServer Language Server Implementation related issues. #Compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement]: Remove adding type descriptor in the extract to constant code action
3 participants