Skip to content

Commit

Permalink
Fix #828: creates file watcher with trailing slash causes problems fo…
Browse files Browse the repository at this point in the history
…r other extensions (#829)
  • Loading branch information
testforstephen authored Apr 19, 2024
1 parent 21f2f12 commit 25d487b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/syncHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SyncHandler implements Disposable {
try {
const uris = await this.getWatchingUris();
for (const uri of uris) {
const normalizedPath: string = uri.fsPath;
const normalizedPath: string = uri.fsPath?.replace(/[\\\/]+$/, ""); // remove trailing slashes
const pattern: RelativePattern = new RelativePattern(normalizedPath, "**/*");
const watcher: FileSystemWatcher = workspace.createFileSystemWatcher(pattern);
this.disposables.push(watcher);
Expand Down
2 changes: 1 addition & 1 deletion src/views/dependencyDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Reload Project' from Command Palette.");
return;
}
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath, "{pom.xml,*.gradle}");
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath?.replace(/[\\\/]+$/, ""), "{pom.xml,*.gradle}");
const uris: Uri[] = await workspace.findFiles(pattern, null /*exclude*/, 1 /*maxResults*/);
if (uris.length >= 1) {
commands.executeCommand(Commands.JAVA_PROJECT_CONFIGURATION_UPDATE, uris[0]);
Expand Down

0 comments on commit 25d487b

Please sign in to comment.