ballerinaballerina-swan-lakeballerina-vscode-plugin

VS Code does not resolve Ballerina modules and gives syntax errors


When a ballerina project is opened with VS code, some modules and syntax are not resolved. I have installed Ballerina VS Code plugin 3.3.13 and the Ballerina version is Ballerina 2201.4.1 (Swan Lake Update 4)

When I try to pull modules using VS code, it gave me the error in the screenshot as a notification.

Bal build will not give any issue.

$ bal build
Compiling source
        choreo/loggingapi:0.1.0

Generating executable
        target/bin/loggingapi.jar

enter image description here

Tried restarting VS Code but this did not work. Can someone help identifying the issue?


Solution

  • I noticed that the Ballerina SDK version on the bottom status bar of VS Code was different from the Ballerina version I have installed. enter image description here

    I fixed this by removing the path in Settings > Ballerina Home enter image description here

    All the packages got resolved after I restarted the app after removing the value for Ballerina Home. When there is no value set, it picks up the version that is installed.