Skip to content

Java Overview will break the import of invisible project #1198

Closed

Description

@Vigilans

When opening a folder containing an invisible project, if Java Overview pops up, the project will fail to be imported, because initializationOptions does not contain a trigger file:

Collection<IPath> triggerFiles = preferencesManager.getPreferences().getTriggerFiles();
if (triggerFiles == null || triggerFiles.isEmpty()) {
    return;
}

from https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/InvisibleProjectImporter.java#L72-L75

It is root-caused in getTriggerFiles, where it only retrives text editors. When Java Overview pops up, the triggered file actually goes to background, and cannot be retrieved in window.visibleTextEditors.

for (const textEditor of window.visibleTextEditors) {
const javaFileInTextEditor = getJavaFilePathOfTextEditor(textEditor);
if (isPrefix(rootPath, javaFileInTextEditor)) {
openedJavaFiles.push(Uri.file(javaFileInTextEditor).toString());
break;
}
}

Environment

  • Operating System: Windows 10
  • Java version: openjdk 1.8
  • Visual Studio Code Version: 1.40.2
  • Java extension version: master branch

Reproduce steps

  1. Make sure Show overview page when using Java is set
  2. Open a folder containing an invisible project.

Sample project: https://github.com/santiontanon/microrts

Current Result

"Classpath is incomplete. Only syntax error is reported."

Expected Result

Project should successfully build.

Activity

  1. fbricon commented on Dec 17, 2019

    @fbricon
    Collaborator

    No idea how we can fix this one

  2. Vigilans commented on Dec 18, 2019

    @Vigilans
    ContributorAuthor

    Maybe we can use workspace.textDocuments instead? I would like to have a try, let me know if this alternative has ever been considered and rejected.

  3. added this to the Mid December 2019 milestone on Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions