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

Refactor LS Workspace Manger #41185

Merged
merged 4 commits into from
Aug 23, 2023

Conversation

malinthar
Copy link
Contributor

@malinthar malinthar commented Aug 10, 2023

Purpose

$subject

Fixes #39097

Approach

With the introduction of the generated module there is a risk of having duplicate files (same file path internally) in a project as depicted in the following image.

image

When a user creates a duplicate document, the user should be notified about it.

The ProjectAPI is able to identify the duplicate document when a project is created (loaded) using the ProjectLoader.loadProject() method.

If there are duplicate files the ProjectAPI throws an ProjectException.

imageThe ProjectAPI throws an ProjectException

This PR refactors the workspace manager to create a new project if the project is erroneous or a new file is created so that the ProjectAPI is able to identify and notify the user about duplicate files.

Samples

projectAPI

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

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Patch coverage: 66.25% and project coverage change: +76.34% 🎉

Comparison is base (de0dbb5) 0.00% compared to head (7fa4c42) 76.34%.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #41185       +/-   ##
=============================================
+ Coverage      0.00%   76.34%   +76.34%     
- Complexity        0    52482    +52482     
=============================================
  Files             9     2881     +2872     
  Lines            35   198407   +198372     
  Branches          0    25793    +25793     
=============================================
+ Hits              0   151478   +151478     
- Misses           35    38570    +38535     
- Partials          0     8359     +8359     
Files Changed Coverage Δ
...angserver/workspace/BallerinaWorkspaceManager.java 68.20% <66.25%> (ø)

... and 2879 files with indirect coverage changes

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

@malinthar malinthar added the Team/LanguageServer Language Server Implementation related issues. #Compiler label Aug 11, 2023
@KavinduZoysa
Copy link
Contributor

Can you check the renaming scenario? i.e. rename a file in the generated folder into an existing file in the root folder.

@malinthar malinthar requested a review from mindula August 15, 2023 03:59
@KavinduZoysa KavinduZoysa merged commit 3a0da28 into ballerina-platform:master Aug 23, 2023
17 checks passed
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]: Notify user when trying to create a new ballerina source file with an existing name
3 participants