Skip to content

Commit 25d487b

Browse files
Fix #828: creates file watcher with trailing slash causes problems for other extensions (#829)
1 parent 21f2f12 commit 25d487b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/syncHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class SyncHandler implements Disposable {
5151
try {
5252
const uris = await this.getWatchingUris();
5353
for (const uri of uris) {
54-
const normalizedPath: string = uri.fsPath;
54+
const normalizedPath: string = uri.fsPath?.replace(/[\\\/]+$/, ""); // remove trailing slashes
5555
const pattern: RelativePattern = new RelativePattern(normalizedPath, "**/*");
5656
const watcher: FileSystemWatcher = workspace.createFileSystemWatcher(pattern);
5757
this.disposables.push(watcher);

src/views/dependencyDataProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
6464
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Reload Project' from Command Palette.");
6565
return;
6666
}
67-
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath, "{pom.xml,*.gradle}");
67+
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath?.replace(/[\\\/]+$/, ""), "{pom.xml,*.gradle}");
6868
const uris: Uri[] = await workspace.findFiles(pattern, null /*exclude*/, 1 /*maxResults*/);
6969
if (uris.length >= 1) {
7070
commands.executeCommand(Commands.JAVA_PROJECT_CONFIGURATION_UPDATE, uris[0]);

0 commit comments

Comments
 (0)