Merge pull request #305550 from mjbvz/dev/mjbvz/tense-dragon

Use `areUrisEqual` helper for better uri checks
This commit is contained in:
Matt Bierner
2026-03-27 01:01:26 -07:00
committed by GitHub

View File

@@ -129,8 +129,9 @@ class MarkdownPreview extends Disposable implements WebviewResourceProvider {
const watcher = this._register(vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(resource, '*')));
this._register(watcher.onDidChange(uri => {
if (this.isPreviewOf(uri)) {
// Only use the file system event when VS Code does not already know about the file
if (!vscode.workspace.textDocuments.some(doc => doc.uri.toString() === uri.toString())) {
// Only use the file system event when VS Code does not already know about the file.
// This is needed to avoid duplicate refreshes
if (!vscode.workspace.textDocuments.some(doc => areUrisEqual(doc.uri, uri))) {
this.refresh();
}
}