Vscode shows fake import errors when saving a file | Java

49 Views Asked by At

After saving/modifying the file, vscode highlighting an error importing my com.papersaccul into visual studio code Despite the fact that gradle.build specifies the path

sourceSets {
    main {
        java {
            srcDirs = ['src/main/java']
        }
    }
}

If I switch to another window and switch back, the errors disappear. The application works fine, built via gradle



after ctrl+s

after switch window



jetbrains doesn't have that problem.

I think the problem is in the standard java debugger (vscjava) even though I've kind of configured the build through gradle in .vs

1

There are 1 best solutions below

0
JialeDu On BEST ANSWER

Restart vscode after using the following command:

Ctrl+Shift+P --> Java: Clean Java Language Server Workspace