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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
1 participant