Skip to content

Commit

Permalink
Removes not well understood sort logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fvclaus committed Oct 7, 2023
1 parent 5315e53 commit 3ec60d1
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -589,14 +588,9 @@ public static IProject getProject(String projectUri) {
throw new IllegalArgumentException(String.format("Did not find container for URI %s", projectUri));
}

// This must be an invisible project. Third party extension could theoretically create invisible projects anywhere
// in the project hierarchy. We therefore pick the most specific path.
// See: https://github.com/microsoft/vscode-java-dependency/pull/791#discussion_r1349435426
Arrays.sort(containers, (Comparator<IContainer>) (IContainer a, IContainer b) -> {
return b.getFullPath().toPortableString().length() - a.getFullPath().toPortableString().length();
});

return containers[containers.length - 1].getProject();
// This must be an invisible project.
// There might be more than one way to access it, but all containers should link to the same project.
return containers[0].getProject();
}
}

Expand Down

0 comments on commit 3ec60d1

Please sign in to comment.