mirror of
https://github.com/Microsoft/vscode
synced 2024-08-25 03:56:03 +00:00
Move updatable hover interfaces to hover.ts
This commit is contained in:
parent
9906083b79
commit
c6a7ca7668
|
@ -11,7 +11,7 @@ import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
|||
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { ISelectBoxOptions, ISelectBoxStyles, ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { IToggleStyles } from 'vs/base/browser/ui/toggle/toggle';
|
||||
import { Action, ActionRunner, IAction, IActionChangeEvent, IActionRunner, Separator } from 'vs/base/common/actions';
|
||||
|
@ -20,6 +20,7 @@ import * as platform from 'vs/base/common/platform';
|
|||
import * as types from 'vs/base/common/types';
|
||||
import 'vs/css!./actionbar';
|
||||
import * as nls from 'vs/nls';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface IBaseActionViewItemOptions {
|
||||
draggable?: boolean;
|
||||
|
|
|
@ -11,7 +11,7 @@ import { renderMarkdown, renderStringAsPlaintext } from 'vs/base/browser/markdow
|
|||
import { Gesture, EventType as TouchEventType } from 'vs/base/browser/touch';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { Action, IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
|
@ -23,6 +23,7 @@ import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecyc
|
|||
import { ThemeIcon } from 'vs/base/common/themables';
|
||||
import 'vs/css!./button';
|
||||
import { localize } from 'vs/nls';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface IButtonOptions extends Partial<IButtonStyles> {
|
||||
readonly title?: boolean | string;
|
||||
|
|
|
@ -8,8 +8,9 @@ import { $, addDisposableListener, append, EventHelper, EventType, isMouseEvent
|
|||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { EventType as GestureEventType, Gesture } from 'vs/base/browser/touch';
|
||||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IMenuOptions } from 'vs/base/browser/ui/menu/menu';
|
||||
import { ActionRunner, IAction } from 'vs/base/common/actions';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import type { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import type { IMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import type { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
@ -227,3 +228,37 @@ export interface IHoverTarget extends IDisposable {
|
|||
*/
|
||||
y?: number;
|
||||
}
|
||||
|
||||
// #region Updatable hover
|
||||
|
||||
export interface IUpdatableHoverTooltipMarkdownString {
|
||||
markdown: IMarkdownString | string | undefined | ((token: CancellationToken) => Promise<IMarkdownString | string | undefined>);
|
||||
markdownNotSupportedFallback: string | undefined;
|
||||
}
|
||||
|
||||
export type IUpdatableHoverContent = string | IUpdatableHoverTooltipMarkdownString | HTMLElement | undefined;
|
||||
|
||||
export interface IUpdatableHoverOptions {
|
||||
actions?: IHoverAction[];
|
||||
linkHandler?(url: string): void;
|
||||
}
|
||||
|
||||
export interface IUpdatableHover extends IDisposable {
|
||||
|
||||
/**
|
||||
* Allows to programmatically open the hover.
|
||||
*/
|
||||
show(focus?: boolean): void;
|
||||
|
||||
/**
|
||||
* Allows to programmatically hide the hover.
|
||||
*/
|
||||
hide(): void;
|
||||
|
||||
/**
|
||||
* Updates the contents of the hover.
|
||||
*/
|
||||
update(tooltip: IUpdatableHoverContent, options?: IUpdatableHoverOptions): void;
|
||||
}
|
||||
|
||||
// #endregion Updatable hover
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type { IHoverWidget } from 'vs/base/browser/ui/hover/hover';
|
||||
import type { IHoverWidget, IUpdatableHoverOptions } from 'vs/base/browser/ui/hover/hover';
|
||||
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import { IUpdatableHoverOptions } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
|
|
@ -7,20 +7,18 @@ import * as dom from 'vs/base/browser/dom';
|
|||
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import { IHoverDelegate, IHoverDelegateOptions, IHoverDelegateTarget } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { TimeoutTimer } from 'vs/base/common/async';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { IMarkdownString, isMarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { stripIcons } from 'vs/base/common/iconLabels';
|
||||
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isFunction, isString } from 'vs/base/common/types';
|
||||
import { localize } from 'vs/nls';
|
||||
import type { IHoverAction, IHoverWidget } from 'vs/base/browser/ui/hover/hover';
|
||||
import type { IHoverWidget, IUpdatableHover, IUpdatableHoverContent, IUpdatableHoverOptions, IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface ITooltipMarkdownString {
|
||||
markdown: IMarkdownString | string | undefined | ((token: CancellationToken) => Promise<IMarkdownString | string | undefined>);
|
||||
markdownNotSupportedFallback: string | undefined;
|
||||
}
|
||||
type IUpdatableHoverContentOrFactory = IUpdatableHoverContent | (() => IUpdatableHoverContent);
|
||||
type IUpdatableHoverResolvedContent = IMarkdownString | string | HTMLElement | undefined;
|
||||
|
||||
export function setupNativeHover(htmlElement: HTMLElement, tooltip: string | ITooltipMarkdownString | undefined): void {
|
||||
export function setupNativeHover(htmlElement: HTMLElement, tooltip: string | IUpdatableHoverTooltipMarkdownString | undefined): void {
|
||||
if (isString(tooltip)) {
|
||||
// Icons don't render in the native hover so we strip them out
|
||||
htmlElement.title = stripIcons(tooltip);
|
||||
|
@ -31,33 +29,6 @@ export function setupNativeHover(htmlElement: HTMLElement, tooltip: string | ITo
|
|||
}
|
||||
}
|
||||
|
||||
type IHoverContent = string | ITooltipMarkdownString | HTMLElement | undefined;
|
||||
type IHoverContentOrFactory = IHoverContent | (() => IHoverContent);
|
||||
type IResolvedHoverContent = IMarkdownString | string | HTMLElement | undefined;
|
||||
|
||||
export interface IUpdatableHoverOptions {
|
||||
actions?: IHoverAction[];
|
||||
linkHandler?(url: string): void;
|
||||
}
|
||||
|
||||
export interface IUpdatableHover extends IDisposable {
|
||||
|
||||
/**
|
||||
* Allows to programmatically open the hover.
|
||||
*/
|
||||
show(focus?: boolean): void;
|
||||
|
||||
/**
|
||||
* Allows to programmatically hide the hover.
|
||||
*/
|
||||
hide(): void;
|
||||
|
||||
/**
|
||||
* Updates the contents of the hover.
|
||||
*/
|
||||
update(tooltip: IHoverContent, options?: IUpdatableHoverOptions): void;
|
||||
}
|
||||
|
||||
class UpdatableHoverWidget implements IDisposable {
|
||||
|
||||
private _hoverWidget: IHoverWidget | undefined;
|
||||
|
@ -66,7 +37,7 @@ class UpdatableHoverWidget implements IDisposable {
|
|||
constructor(private hoverDelegate: IHoverDelegate, private target: IHoverDelegateTarget | HTMLElement, private fadeInAnimation: boolean) {
|
||||
}
|
||||
|
||||
async update(content: IHoverContent, focus?: boolean, options?: IUpdatableHoverOptions): Promise<void> {
|
||||
async update(content: IUpdatableHoverContent, focus?: boolean, options?: IUpdatableHoverOptions): Promise<void> {
|
||||
if (this._cancellationTokenSource) {
|
||||
// there's an computation ongoing, cancel it
|
||||
this._cancellationTokenSource.dispose(true);
|
||||
|
@ -107,7 +78,7 @@ class UpdatableHoverWidget implements IDisposable {
|
|||
this.show(resolvedContent, focus, options);
|
||||
}
|
||||
|
||||
private show(content: IResolvedHoverContent, focus?: boolean, options?: IUpdatableHoverOptions): void {
|
||||
private show(content: IUpdatableHoverResolvedContent, focus?: boolean, options?: IUpdatableHoverOptions): void {
|
||||
const oldHoverWidget = this._hoverWidget;
|
||||
|
||||
if (this.hasContent(content)) {
|
||||
|
@ -129,7 +100,7 @@ class UpdatableHoverWidget implements IDisposable {
|
|||
oldHoverWidget?.dispose();
|
||||
}
|
||||
|
||||
private hasContent(content: IResolvedHoverContent): content is NonNullable<IResolvedHoverContent> {
|
||||
private hasContent(content: IUpdatableHoverResolvedContent): content is NonNullable<IUpdatableHoverResolvedContent> {
|
||||
if (!content) {
|
||||
return false;
|
||||
}
|
||||
|
@ -160,7 +131,7 @@ function getHoverTargetElement(element: HTMLElement, stopElement?: HTMLElement):
|
|||
return element;
|
||||
}
|
||||
|
||||
export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IHoverContentOrFactory, options?: IUpdatableHoverOptions): IUpdatableHover {
|
||||
export function setupCustomHover(hoverDelegate: IHoverDelegate, htmlElement: HTMLElement, content: IUpdatableHoverContentOrFactory, options?: IUpdatableHoverOptions): IUpdatableHover {
|
||||
htmlElement.setAttribute('custom-hover', 'true');
|
||||
|
||||
if (htmlElement.title !== '') {
|
||||
|
|
|
@ -7,12 +7,13 @@ import 'vs/css!./iconlabel';
|
|||
import * as dom from 'vs/base/browser/dom';
|
||||
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { ITooltipMarkdownString, setupCustomHover, setupNativeHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover, setupNativeHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IMatch } from 'vs/base/common/filters';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { equals } from 'vs/base/common/objects';
|
||||
import { Range } from 'vs/base/common/range';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import type { IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface IIconLabelCreationOptions {
|
||||
readonly supportHighlights?: boolean;
|
||||
|
@ -22,8 +23,8 @@ export interface IIconLabelCreationOptions {
|
|||
}
|
||||
|
||||
export interface IIconLabelValueOptions {
|
||||
title?: string | ITooltipMarkdownString;
|
||||
descriptionTitle?: string | ITooltipMarkdownString;
|
||||
title?: string | IUpdatableHoverTooltipMarkdownString;
|
||||
descriptionTitle?: string | IUpdatableHoverTooltipMarkdownString;
|
||||
suffix?: string;
|
||||
hideIcon?: boolean;
|
||||
extraClasses?: readonly string[];
|
||||
|
@ -175,7 +176,7 @@ export class IconLabel extends Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
private setupHover(htmlElement: HTMLElement, tooltip: string | ITooltipMarkdownString | undefined): void {
|
||||
private setupHover(htmlElement: HTMLElement, tooltip: string | IUpdatableHoverTooltipMarkdownString | undefined): void {
|
||||
const previousCustomHover = this.customHovers.get(htmlElement);
|
||||
if (previousCustomHover) {
|
||||
previousCustomHover.dispose();
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { reset } from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@ import { MarkdownRenderOptions } from 'vs/base/browser/markdownRenderer';
|
|||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import * as aria from 'vs/base/browser/ui/aria/aria';
|
||||
import { AnchorAlignment, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { UILabelProvider } from 'vs/base/common/keybindingLabels';
|
||||
import { ResolvedKeybinding, ResolvedChord } from 'vs/base/common/keybindings';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
|
|
@ -9,8 +9,9 @@ import { IContentActionHandler } from 'vs/base/browser/formattedTextRenderer';
|
|||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { renderMarkdown } from 'vs/base/browser/markdownRenderer';
|
||||
import { AnchorPosition, IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IListEvent, IListRenderer, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { ISelectBoxDelegate, ISelectBoxOptions, ISelectBoxStyles, ISelectData, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
|
|
|
@ -13,9 +13,10 @@ import { Emitter, Event } from 'vs/base/common/event';
|
|||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import 'vs/css!./toggle';
|
||||
import { isActiveElement, $, addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface IToggleOpts extends IToggleStyles {
|
||||
readonly actionClassName?: string;
|
||||
|
|
|
@ -12,9 +12,10 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
|||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import 'vs/css!./link';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export interface ILinkDescriptor {
|
||||
readonly label: string | HTMLElement;
|
||||
|
|
|
@ -27,7 +27,6 @@ import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLa
|
|||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { isDark } from 'vs/platform/theme/common/theme';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITooltipMarkdownString } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { quickInputButtonToAction } from 'vs/platform/quickinput/browser/quickInputUtils';
|
||||
import { Lazy } from 'vs/base/common/lazy';
|
||||
import { IParsedLabelWithIcons, getCodiconAriaLabel, matchesFuzzyIconAware, parseLabelWithIcons } from 'vs/base/common/iconLabels';
|
||||
|
@ -37,7 +36,7 @@ import { ltrim } from 'vs/base/common/strings';
|
|||
import { RenderIndentGuides } from 'vs/base/browser/ui/tree/abstractTree';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
import { isCancellationError } from 'vs/base/common/errors';
|
||||
import type { IHoverWidget } from 'vs/base/browser/ui/hover/hover';
|
||||
import type { IHoverWidget, IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
@ -445,7 +444,7 @@ class QuickPickItemElementRenderer extends BaseQuickInputListRenderer<QuickPickI
|
|||
}
|
||||
|
||||
// Label
|
||||
let descriptionTitle: ITooltipMarkdownString | undefined;
|
||||
let descriptionTitle: IUpdatableHoverTooltipMarkdownString | undefined;
|
||||
// if we have a tooltip, that will be the hover,
|
||||
// with the saneDescription as fallback if it
|
||||
// is defined
|
||||
|
@ -476,7 +475,7 @@ class QuickPickItemElementRenderer extends BaseQuickInputListRenderer<QuickPickI
|
|||
|
||||
// Detail
|
||||
if (element.saneDetail) {
|
||||
let title: ITooltipMarkdownString | undefined;
|
||||
let title: IUpdatableHoverTooltipMarkdownString | undefined;
|
||||
// If we have a tooltip, we want that to be shown and not any other hover
|
||||
if (!element.saneTooltip) {
|
||||
title = {
|
||||
|
@ -577,7 +576,7 @@ class QuickPickSeparatorElementRenderer extends BaseQuickInputListRenderer<Quick
|
|||
data.icon.className = '';
|
||||
|
||||
// Label
|
||||
let descriptionTitle: ITooltipMarkdownString | undefined;
|
||||
let descriptionTitle: IUpdatableHoverTooltipMarkdownString | undefined;
|
||||
// if we have a tooltip, that will be the hover,
|
||||
// with the saneDescription as fallback if it
|
||||
// is defined
|
||||
|
@ -602,7 +601,7 @@ class QuickPickSeparatorElementRenderer extends BaseQuickInputListRenderer<Quick
|
|||
|
||||
// Detail
|
||||
if (element.saneDetail) {
|
||||
let title: ITooltipMarkdownString | undefined;
|
||||
let title: IUpdatableHoverTooltipMarkdownString | undefined;
|
||||
// If we have a tooltip, we want that to be shown and not any other hover
|
||||
if (!element.saneTooltip) {
|
||||
title = {
|
||||
|
|
|
@ -29,8 +29,9 @@ import { Event } from 'vs/base/common/event';
|
|||
import { defaultButtonStyles, defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export class NotificationsListDelegate implements IListVirtualDelegate<INotificationViewItem> {
|
||||
|
||||
|
|
|
@ -21,10 +21,11 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
|||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { renderIcon, renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { spinningLoading, syncing } from 'vs/platform/theme/common/iconRegistry';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { isMarkdownString, markdownStringEqual } from 'vs/base/common/htmlContent';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { Gesture, EventType as TouchEventType } from 'vs/base/browser/touch';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export class StatusbarEntryItem extends Disposable {
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { Toggle } from 'vs/base/browser/ui/toggle/toggle';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
|
|
|
@ -9,7 +9,6 @@ import { renderMarkdownAsPlaintext } from 'vs/base/browser/markdownRenderer';
|
|||
import { ActionBar, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { ITooltipMarkdownString } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IIdentityProvider, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { ElementsDragAndDropData, ListViewTargetSector } from 'vs/base/browser/ui/list/listView';
|
||||
import { IAsyncDataSource, ITreeContextMenuEvent, ITreeDragAndDrop, ITreeDragOverReaction, ITreeNode, ITreeRenderer, TreeDragOverBubble } from 'vs/base/browser/ui/tree/tree';
|
||||
|
@ -73,6 +72,7 @@ import { TelemetryTrustedValue } from 'vs/platform/telemetry/common/telemetryUti
|
|||
import { ITreeViewsDnDService } from 'vs/editor/common/services/treeViewsDndService';
|
||||
import { DraggedTreeItemsIdentifier } from 'vs/editor/common/services/treeViewsDnd';
|
||||
import { IMarkdownRenderResult, MarkdownRenderer } from 'vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
||||
import type { IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export class TreeViewPane extends ViewPane {
|
||||
|
||||
|
@ -1136,7 +1136,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
|||
return { resourceLabel, icon, checkboxContainer, actionBar, container, elementDisposable: new DisposableStore() };
|
||||
}
|
||||
|
||||
private getHover(label: string | undefined, resource: URI | null, node: ITreeItem): string | ITooltipMarkdownString | undefined {
|
||||
private getHover(label: string | undefined, resource: URI | null, node: ITreeItem): string | IUpdatableHoverTooltipMarkdownString | undefined {
|
||||
if (!(node instanceof ResolvableTreeItem) || !node.hasResolve) {
|
||||
if (resource && !node.tooltip) {
|
||||
return undefined;
|
||||
|
|
|
@ -47,9 +47,10 @@ import { FilterWidget, IFilterWidgetOptions } from 'vs/workbench/browser/parts/v
|
|||
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { defaultButtonStyles, defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export enum ViewPaneShowActions {
|
||||
/** Show the actions when the view is hovered. This is the default behavior. */
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { fromNow } from 'vs/base/common/date';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { language } from 'vs/base/common/platform';
|
||||
|
|
|
@ -48,8 +48,9 @@ import { createDisconnectMenuItemAction } from 'vs/workbench/contrib/debug/brows
|
|||
import { CALLSTACK_VIEW_ID, CONTEXT_CALLSTACK_ITEM_STOPPED, CONTEXT_CALLSTACK_ITEM_TYPE, CONTEXT_CALLSTACK_SESSION_HAS_ONE_THREAD, CONTEXT_CALLSTACK_SESSION_IS_ATTACH, CONTEXT_DEBUG_STATE, CONTEXT_FOCUSED_SESSION_IS_NO_DEBUG, CONTEXT_STACK_FRAME_SUPPORTS_RESTART, getStateLabel, IDebugModel, IDebugService, IDebugSession, IRawStoppedDetails, isFrameDeemphasized, IStackFrame, IThread, State } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { StackFrame, Thread, ThreadAndSessionIds } from 'vs/workbench/contrib/debug/common/debugModel';
|
||||
import { isSessionAttach } from 'vs/workbench/contrib/debug/common/debugUtils';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
const $ = dom.$;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import { URI } from 'vs/base/common/uri';
|
|||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { renderMarkdown } from 'vs/base/browser/markdownRenderer';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
|
@ -43,6 +43,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|||
import { defaultCountBadgeStyles } from 'vs/platform/theme/browser/defaultStyles';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export abstract class ExtensionWidget extends Disposable implements IExtensionContainer {
|
||||
private _extension: IExtension | null = null;
|
||||
|
|
|
@ -51,8 +51,9 @@ import { MarkersContextKeys, MarkersViewMode } from 'vs/workbench/contrib/marker
|
|||
import { unsupportedSchemas } from 'vs/platform/markers/common/markerService';
|
||||
import { defaultCountBadgeStyles } from 'vs/platform/theme/browser/defaultStyles';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
interface IResourceMarkersTemplateData {
|
||||
readonly resourceLabel: IResourceLabel;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { EventType as TouchEventType } from 'vs/base/browser/touch';
|
|||
import { IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IActionProvider } from 'vs/base/browser/ui/dropdown/dropdown';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ThemeIcon } from 'vs/base/common/themables';
|
||||
|
@ -18,6 +18,7 @@ import { MenuItemAction, SubmenuItemAction } from 'vs/platform/actions/common/ac
|
|||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
export class CodiconActionViewItem extends MenuEntryActionViewItem {
|
||||
|
||||
|
|
|
@ -27,11 +27,12 @@ import { CellContentPart } from 'vs/workbench/contrib/notebook/browser/view/cell
|
|||
import { ClickTargetType, IClickTarget } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellWidgets';
|
||||
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
|
||||
import { CellStatusbarAlignment, INotebookCellStatusBarItem } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { ITooltipMarkdownString, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { IHoverDelegate, IHoverDelegateOptions } from 'vs/base/browser/ui/hover/hoverDelegate';
|
||||
import { IHoverService } from 'vs/platform/hover/browser/hover';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import type { IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
|
@ -326,7 +327,7 @@ class CellStatusBarItem extends Disposable {
|
|||
this.container.setAttribute('role', role || '');
|
||||
|
||||
if (item.tooltip) {
|
||||
const hoverContent = typeof item.tooltip === 'string' ? item.tooltip : { markdown: item.tooltip } as ITooltipMarkdownString;
|
||||
const hoverContent = typeof item.tooltip === 'string' ? item.tooltip : { markdown: item.tooltip } as IUpdatableHoverTooltipMarkdownString;
|
||||
this._itemDisposables.add(setupCustomHover(this._hoverDelegate, this.container, hoverContent));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,10 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
||||
import { registerNavigableContainer } from 'vs/workbench/browser/actions/widgetNavigationCommands';
|
||||
import { IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
const $ = DOM.$;
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ import { isWorkspaceFolder, IWorkspaceContextService, IWorkspaceFolder, Workbenc
|
|||
import { settingsEditIcon, settingsScopeDropDownIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { ILanguageService } from 'vs/editor/common/languages/language';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
export class FolderSettingsActionViewItem extends BaseActionViewItem {
|
||||
|
||||
private _folder: IWorkspaceFolder | null;
|
||||
|
|
|
@ -106,9 +106,10 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
|||
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
|
||||
import { clamp } from 'vs/base/common/numbers';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IUpdatableHover, ITooltipMarkdownString, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { MarkdownString } from 'vs/base/common/htmlContent';
|
||||
import type { IUpdatableHover, IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
|
||||
// type SCMResourceTreeNode = IResourceNode<ISCMResource, ISCMResourceGroup>;
|
||||
// type SCMHistoryItemChangeResourceTreeNode = IResourceNode<SCMHistoryItemChangeTreeElement, SCMHistoryItemTreeElement>;
|
||||
|
@ -966,7 +967,7 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
|
|||
throw new Error('Should never happen since node is incompressible');
|
||||
}
|
||||
|
||||
private getTooltip(historyItem: SCMHistoryItemTreeElement): ITooltipMarkdownString {
|
||||
private getTooltip(historyItem: SCMHistoryItemTreeElement): IUpdatableHoverTooltipMarkdownString {
|
||||
const markdown = new MarkdownString('', { isTrusted: true, supportThemeIcons: true });
|
||||
|
||||
if (historyItem.author) {
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { h } from 'vs/base/browser/dom';
|
||||
import type { IUpdatableHover, IUpdatableHoverTooltipMarkdownString } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, ITooltipMarkdownString, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { assertNever } from 'vs/base/common/assert';
|
||||
import { MarkdownString } from 'vs/base/common/htmlContent';
|
||||
import { Lazy } from 'vs/base/common/lazy';
|
||||
|
@ -77,7 +78,7 @@ export class ManagedTestCoverageBars extends Disposable {
|
|||
super();
|
||||
}
|
||||
|
||||
private attachHover(target: HTMLElement, factory: (coverage: CoverageBarSource) => string | ITooltipMarkdownString | undefined) {
|
||||
private attachHover(target: HTMLElement, factory: (coverage: CoverageBarSource) => string | IUpdatableHoverTooltipMarkdownString | undefined) {
|
||||
this._register(setupCustomHover(getDefaultHoverDelegate('element'), target, () => this._coverage && factory(this._coverage)));
|
||||
}
|
||||
|
||||
|
@ -203,7 +204,7 @@ const stmtCoverageText = (coverage: CoverageBarSource) => localize('statementCov
|
|||
const fnCoverageText = (coverage: CoverageBarSource) => coverage.declaration && localize('functionCoverage', '{0}/{1} functions covered ({2})', nf.format(coverage.declaration.covered), nf.format(coverage.declaration.total), displayPercent(percent(coverage.declaration)));
|
||||
const branchCoverageText = (coverage: CoverageBarSource) => coverage.branch && localize('branchCoverage', '{0}/{1} branches covered ({2})', nf.format(coverage.branch.covered), nf.format(coverage.branch.total), displayPercent(percent(coverage.branch)));
|
||||
|
||||
const getOverallHoverText = (coverage: CoverageBarSource): ITooltipMarkdownString => {
|
||||
const getOverallHoverText = (coverage: CoverageBarSource): IUpdatableHoverTooltipMarkdownString => {
|
||||
const str = [
|
||||
stmtCoverageText(coverage),
|
||||
fnCoverageText(coverage),
|
||||
|
|
|
@ -8,8 +8,9 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
|||
import { IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { ActionBar, IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import type { IUpdatableHover } from 'vs/base/browser/ui/hover/hover';
|
||||
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
|
||||
import { IUpdatableHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
|
||||
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
|
||||
import { IIdentityProvider, IKeyboardNavigationLabelProvider, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { DefaultKeyboardNavigationDelegate, IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
|
||||
|
|
Loading…
Reference in a new issue