Skip to content

Commit

Permalink
Use java.import.exclusions config when determining trigger files
Browse files Browse the repository at this point in the history
  • Loading branch information
gluxon committed Oct 25, 2023
1 parent ff5fcb3 commit 5c2a866
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -918,15 +918,18 @@ async function getTriggerFiles(): Promise<string[]> {
}
}

const javaFilesUnderRoot: Uri[] = await workspace.findFiles(new RelativePattern(rootFolder, "*.java"), undefined, 1);
// Paths set by 'java.import.exclusions' will be ignored when searching trigger files.
const exclusionGlob = getExclusionBlob();

const javaFilesUnderRoot: Uri[] = await workspace.findFiles(new RelativePattern(rootFolder, "*.java"), exclusionGlob, 1);
for (const javaFile of javaFilesUnderRoot) {
if (isPrefix(rootPath, javaFile.fsPath)) {
openedJavaFiles.push(javaFile.toString());
return;
}
}

const javaFilesInCommonPlaces: Uri[] = await workspace.findFiles(new RelativePattern(rootFolder, "{src, test}/**/*.java"), undefined, 1);
const javaFilesInCommonPlaces: Uri[] = await workspace.findFiles(new RelativePattern(rootFolder, "{src, test}/**/*.java"), exclusionGlob, 1);
for (const javaFile of javaFilesInCommonPlaces) {
if (isPrefix(rootPath, javaFile.fsPath)) {
openedJavaFiles.push(javaFile.toString());
Expand Down

0 comments on commit 5c2a866

Please sign in to comment.