[Improvement]: Notify user when trying to create a new ballerina source file with an existing name #39097
Labels
Points/2
Equivalent to two days effort
Priority/High
Team/LanguageServer
Language Server Implementation related issues. #Compiler
Type/Improvement
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
andgenerated/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
The text was updated successfully, but these errors were encountered: