Skip to content

Commit 8bb3ad6

Browse files
authored
fix: Exceptions when opening a file which is not on the build path (#527)
1 parent a7e265b commit 8bb3ad6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/PackageCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ public static List<PackageNode> resolvePath(List<Object> arguments, IProgressMon
129129
// Add project node:
130130
result.add(PackageNode.createNodeForProject(typeRoot));
131131
IPackageFragment packageFragment = (IPackageFragment) typeRoot.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
132+
if (!packageFragment.exists()) {
133+
return Collections.emptyList();
134+
}
132135
IPackageFragmentRoot pkgRoot = (IPackageFragmentRoot) packageFragment.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
133136
// TODO: Let the client handle the display instead. Server side should always
134137
// provide the container node.

0 commit comments

Comments
 (0)