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

[Improvement]: Notify user when trying to create a new ballerina source file with an existing name #39097

Closed
Dilhasha opened this issue Dec 16, 2022 · 0 comments · Fixed by #41185
Assignees
Labels
Points/2 Equivalent to two days effort Priority/High Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement

Comments

@Dilhasha
Copy link
Contributor

Dilhasha commented Dec 16, 2022

Description

The existing project structure doesn't allow having documents with the same name in the same module due to being loaded from a single file path. e.g. mod1 can only have one mod1.bal.

But, with the generated sources support added with #38977, the file structure doesn't restrict this. e.g. mod1 can have modules/mod1/mod1.bal and generated/mod1/mod1.bal.

Describe your problem(s)

This is problematic because the document path is similar for such files and Ballerina internally relies on the document path to uniquely identify documents, for diagnostics, etc.
While source generation tools should create files with unique names, we need to notify users if they try to create source files with an existing generated source name.

Describe your solution(s)

From, project API perspective, if 2 files with the same name exist, a ProjectAPIException will be thrown and it will get logged in the output console for VSCode. But, we need to be sure that user notices what went wrong and notify on how to resolve preferably via a popup dialog.

Related area

-> Other Area

Related issue(s) (optional)

#38766

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

@IMS94 @malinthar

@Dilhasha Dilhasha added Type/Improvement Team/LanguageServer Language Server Implementation related issues. #Compiler labels Dec 16, 2022
@KavinduZoysa KavinduZoysa added the Points/2 Equivalent to two days effort label Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Points/2 Equivalent to two days effort Priority/High Team/LanguageServer Language Server Implementation related issues. #Compiler Type/Improvement
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants