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

[Bug]: Deleting a generated file doesn't show diagnostics immediately #40119

Closed
Dilhasha opened this issue Apr 6, 2023 · 2 comments · Fixed by #40274
Closed

[Bug]: Deleting a generated file doesn't show diagnostics immediately #40119

Dilhasha opened this issue Apr 6, 2023 · 2 comments · Fixed by #40274
Assignees
Labels
Area/ProjectAPI Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Milestone

Comments

@Dilhasha
Copy link
Contributor

Dilhasha commented Apr 6, 2023

Description

Delete a generated file that has a function used by a non-generated function. That doesn't show diagnostics immediately without reloading. This is applicable for both source and test files.

Steps to Reproduce

For source files:

main.bal

import ballerina/io;

public function main() {
    io:println("Hello, World!");
    io:println(helloTest());
}

generated/main_new.bal

function helloTest() returns string {
    return "Hello World";
}

For test files:

mod1/test1.bal

@test:Config {}
function testFunction2() {
    string welcomeMsg = helloTest();
    test:assertEquals("Hello World", welcomeMsg);
}

generated/mod1/test_new1.bal

function helloTest() returns string {
    return "Hello World";
}

We need to test same for when using source function in a test case and deleting source file.

Affected Version(s)

2201.4.x, 2201.5.0

OS, DB, other environment details and versions

No response

Related area

-> Other Area

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@Dilhasha Dilhasha added Type/Bug Area/ProjectAPI Reason/EngineeringMistake The issue occurred due to a mistake made in the past. labels Apr 6, 2023
@Dilhasha Dilhasha self-assigned this Apr 6, 2023
@Dilhasha Dilhasha changed the title [Bug]: Deleting a generated filedoesn't show diagnostics immediately [Bug]: Deleting a generated file doesn't show diagnostics immediately Apr 6, 2023
@ballerina-bot ballerina-bot added the needTriage The issue has to be inspected and labeled manually label Apr 6, 2023
@Dilhasha Dilhasha removed the needTriage The issue has to be inspected and labeled manually label Apr 6, 2023
@Dilhasha
Copy link
Contributor Author

Dilhasha commented Apr 21, 2023

This happens only for the default module i.e. if a function in a generated file is called in another project file and then the generated file is deleted.

But calling non-default module functions from any module does not result in the mentioned behavior.

<style type="text/css"></style>

The function is defined at The function is called at immediately shows diagnostic when deleted
generated default module source default module source no
generated default module source generated default module test source no
generated default module source default module test source no
generated non-default module source default module source yes
generated non-default module source non-default module source yes
generated non default module source generated default module source yes
generated non default module source generated non-default module test source yes

The only difference I could notice between the two scenarios is that the params parameter has a duplicated entry during deleting the default module function in the below method call.

https://github.com/ballerina-platform/ballerina-lang/blob/master/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/BallerinaWorkspaceService.java#L87

@Dilhasha
Copy link
Contributor Author

This was due to a duplicated listener registered for same file.

@Dilhasha Dilhasha added this to the 2201.6.0 milestone Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/ProjectAPI Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants