do not index package-info.java files

Fixes GH-1426
This commit is contained in:
Martin Lippert
2024-12-10 08:21:17 +01:00
parent 25c21479b2
commit 783bb4b32d
5 changed files with 12 additions and 10 deletions

View File

@@ -90,9 +90,9 @@ public class SpringFactoriesIndexer implements SpringIndexer {
}
@Override
public boolean isInterestedIn(String docURI) {
if (docURI.endsWith(".factories")) {
Path path = Paths.get(URI.create(docURI));
public boolean isInterestedIn(String resource) {
if (resource.endsWith(".factories")) {
Path path = Paths.get(URI.create(resource));
return FILE_GLOB_PATTERN.matches(path);
}
return false;

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Pivotal, Inc.
* Copyright (c) 2019, 2024 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.springframework.ide.vscode.commons.java.IJavaProject;
public interface SpringIndexer {
String[] getFileWatchPatterns();
boolean isInterestedIn(String docURI);
boolean isInterestedIn(String resource); // note that this might be a document URI or a standard file path on the system
List<EnhancedSymbolInformation> computeSymbols(IJavaProject project, String docURI, String content) throws Exception;

View File

@@ -148,8 +148,8 @@ public class SpringIndexerJava implements SpringIndexer {
}
@Override
public boolean isInterestedIn(String docURI) {
return docURI.endsWith(".java");
public boolean isInterestedIn(String resource) {
return resource.endsWith(".java") && !resource.endsWith("package-info.java");
}
@Override
@@ -841,7 +841,7 @@ public class SpringIndexerJava implements SpringIndexer {
return Stream.empty();
}
})
.filter(path -> path.getFileName().toString().endsWith(".java"))
.filter(path -> isInterestedIn(path.getFileName().toString()))
.filter(Files::isRegularFile)
.map(path -> path.toAbsolutePath().toString())
.toArray(String[]::new);

View File

@@ -105,8 +105,8 @@ public class SpringIndexerXML implements SpringIndexer {
}
@Override
public boolean isInterestedIn(String docURI) {
return docURI.endsWith(".xml");
public boolean isInterestedIn(String resource) {
return resource.endsWith(".xml");
}
@Override