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

Provide code actions to fix invalid transferring of an isolated value out from a lock statement #42734

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

Conversation

nipunayf
Copy link
Contributor

@nipunayf nipunayf commented May 10, 2024

Purpose

$title.

Fixes #42333

Approach

Introduced two code actions, namely clone value and add readonly type, to fix the respective scenarios.

Samples

Clone the value

Screen.Recording.2024-05-10.at.5.21.20.PM.mov

Clone as a readonly value

Screen.Recording.2024-05-10.at.5.21.29.PM.mov

Add readonly to type

Screen.Recording.2024-05-20.at.11.04.55.PM.mov

Remarks

  • For union types, we are enclosing the entire type instead of making each required individual type readonly.
  • The "Add readonly" code action is not supported for any and json types, as their locations cannot be captured.
  • Type reference type symbols are not supported for Add readonly code action as their original location points to the definition.

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 May 10, 2024
@nipunayf nipunayf changed the title Provide code actions to fix invalid attempts to transfer out a value from a lock statement [WIP] Provide code actions to fix invalid attempts to transfer out a value from a lock statement May 10, 2024
@nipunayf nipunayf changed the title [WIP] Provide code actions to fix invalid attempts to transfer out a value from a lock statement [WIP] Provide code actions to fix invalid transferring of an isolated value out from a lock statement May 10, 2024
Copy link

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 91.93548% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 77.27%. Comparing base (dc8f8ed) to head (69485b3).
Report is 4 commits behind head on master.

Files Patch % Lines
...ver/codeaction/providers/CloneValueCodeAction.java 84.00% 2 Missing and 2 partials ⚠️
...er/codeaction/providers/AddReadonlyCodeAction.java 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #42734   +/-   ##
=========================================
  Coverage     77.26%   77.27%           
- Complexity    51304    51331   +27     
=========================================
  Files          2929     2931    +2     
  Lines        204423   204485   +62     
  Branches      26668    26678   +10     
=========================================
+ Hits         157947   158006   +59     
- Misses        37890    37891    +1     
- Partials       8586     8588    +2     

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

@nipunayf nipunayf added this to the 2201.10.0 milestone May 17, 2024
@nipunayf nipunayf marked this pull request as ready for review May 21, 2024 04:27
@nipunayf nipunayf changed the title [WIP] Provide code actions to fix invalid transferring of an isolated value out from a lock statement Provide code actions to fix invalid transferring of an isolated value out from a lock statement May 21, 2024
@nipunayf nipunayf force-pushed the fix-42333 branch 2 times, most recently from 1a70974 to 320c306 Compare May 21, 2024 13:41
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]: Provide a quick-fix code action for invalid transfer out of a lock statement
1 participant