Skip to content

Commit 4dab038

Browse files
committed
code: Compare the string representation of URIs
For some reason, the object representation of the same URI is not stable leading to synchronised scrolling breaking after scrolling the preview window. Instead, compare the string representation of the uris which should work around the differences that should not matter.
1 parent 34d6d99 commit 4dab038

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

code/changes/875.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure scrolling is still synchronised, even after scrolling the preview window

code/src/node/preview.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ export class PreviewManager {
7878
}
7979

8080
private scrollView(editor: vscode.TextEditor) {
81-
if (editor.document.uri !== this.currentUri) {
81+
// For some reason, the object representation of the same URI is not stable
82+
// leading this check to fail in cases where it should pass.
83+
// Instead, compare the string representation of the uris.
84+
if (editor.document.uri.toString() !== this.currentUri?.toString()) {
8285
return
8386
}
8487

0 commit comments

Comments
 (0)