Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #828: creates file watcher with trailing slash causes problems for other extensions #829

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading