From 909a1067252f1adaa49f5ecf97cda63c641f361d Mon Sep 17 00:00:00 2001 From: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:26:48 -0700 Subject: [PATCH] Use case insentive file uri compare in md extension For #265277 --- .../markdown-language-features/src/preview/preview.ts | 6 +++--- .../markdown-language-features/src/util/resources.ts | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/extensions/markdown-language-features/src/preview/preview.ts b/extensions/markdown-language-features/src/preview/preview.ts index 19d1755e7eb..1053c305cac 100644 --- a/extensions/markdown-language-features/src/preview/preview.ts +++ b/extensions/markdown-language-features/src/preview/preview.ts @@ -10,7 +10,7 @@ import { MarkdownContributionProvider } from '../markdownExtensions'; import { Disposable } from '../util/dispose'; import { isMarkdownFile } from '../util/file'; import { MdLinkOpener } from '../util/openDocumentLink'; -import { WebviewResourceProvider } from '../util/resources'; +import { areUrisEqual, WebviewResourceProvider } from '../util/resources'; import { urlToUri } from '../util/url'; import { ImageInfo, MdDocumentRenderer } from './documentRenderer'; import { MarkdownPreviewConfigurationManager } from './previewConfig'; @@ -29,7 +29,7 @@ export class PreviewDocumentVersion { } public equals(other: PreviewDocumentVersion): boolean { - return this.resource.fsPath === other.resource.fsPath + return areUrisEqual(this.resource, other.resource) && this._version === other._version; } } @@ -204,7 +204,7 @@ class MarkdownPreview extends Disposable implements WebviewResourceProvider { public isPreviewOf(resource: vscode.Uri): boolean { - return this._resource.fsPath === resource.fsPath; + return areUrisEqual(this._resource, resource); } public postMessage(msg: ToWebviewMessage.Type) { diff --git a/extensions/markdown-language-features/src/util/resources.ts b/extensions/markdown-language-features/src/util/resources.ts index f1f2d0886ab..a3248b954db 100644 --- a/extensions/markdown-language-features/src/util/resources.ts +++ b/extensions/markdown-language-features/src/util/resources.ts @@ -11,3 +11,10 @@ export interface WebviewResourceProvider { readonly cspSource: string; } +export function areUrisEqual(uri1: vscode.Uri, uri2: vscode.Uri): boolean { + if (uri1.scheme === 'file' && uri2.scheme === 'file') { + return uri1.fsPath.toLowerCase() === uri2.fsPath.toLowerCase(); + } + + return uri1.fsPath === uri2.fsPath; +}