From 344a62e51f48d7d9f0c0b8736009d5df08d01ab4 Mon Sep 17 00:00:00 2001 From: Jody Heavener Date: Thu, 23 May 2024 15:44:15 -0700 Subject: [PATCH] Disable secret previews on Windows --- src/editor.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/editor.ts b/src/editor.ts index 2950c5e..25dcee1 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -1,3 +1,4 @@ +import os from "os"; import { Disposable, languages } from "vscode"; import { config } from "./configuration"; import type { Core } from "./core"; @@ -15,6 +16,8 @@ export class Editor { } private configure(): void { + const isWindows = os.platform() === "win32"; + for (const subscription of this.subscriptions) { subscription.dispose(); } @@ -32,13 +35,16 @@ export class Editor { provideDocumentLinks, }, ), - languages.registerHoverProvider( - { scheme: "file" }, - { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - provideHover: provideHover.bind(this.core), - }, - ), + // Windows doesn't persist auth between commands, so authenticating + // first has no effect, preventing hover previews from working + !isWindows && + languages.registerHoverProvider( + { scheme: "file" }, + { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + provideHover: provideHover.bind(this.core), + }, + ), ]; this.core.context.subscriptions.push(...this.subscriptions);