From 70392d7d514a55bd1825cd3ad549c5add156f00d Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Wed, 22 Jun 2022 09:11:59 -0700 Subject: [PATCH] Dispose custom hover after clicking link (#152800) Ref #151787 --- .../preferences/browser/settingsEditorSettingIndicators.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts index b30d6b3333ea6..4398f140cab59 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.ts @@ -6,7 +6,7 @@ import * as DOM from 'vs/base/browser/dom'; import { IMouseEvent } from 'vs/base/browser/mouseEvent'; import { IHoverDelegate, IHoverDelegateOptions } from 'vs/base/browser/ui/iconLabel/iconHoverDelegate'; -import { ITooltipMarkdownString, IUpdatableHoverOptions, setupCustomHover } from 'vs/base/browser/ui/iconLabel/iconLabelHover'; +import { ICustomHover, ITooltipMarkdownString, IUpdatableHoverOptions, setupCustomHover } from 'vs/base/browser/ui/iconLabel/iconLabelHover'; import { SimpleIconLabel } from 'vs/base/browser/ui/iconLabel/simpleIconLabel'; import { Emitter } from 'vs/base/common/event'; import { DisposableStore } from 'vs/base/common/lifecycle'; @@ -153,15 +153,17 @@ export class SettingsTreeIndicatorsLabel { }, markdownNotSupportedFallback: contentFallback }; + let hover: ICustomHover | undefined = undefined; const options: IUpdatableHoverOptions = { linkHandler: (scope: string) => { onDidClickOverrideElement.fire({ targetKey: element.setting.key, scope }); + hover!.dispose(); } }; - setupCustomHover(this.hoverDelegate, this.scopeOverridesElement, content, options); + hover = setupCustomHover(this.hoverDelegate, this.scopeOverridesElement, content, options); } } this.render();