Remove all remaining usages of setupCustomHover

This commit is contained in:
Daniel Imms 2024-04-03 07:58:48 -07:00
parent c1169fbdac
commit fc5dd80cfe
No known key found for this signature in database
GPG key ID: E5CF412B63651C69
27 changed files with 195 additions and 105 deletions

View file

@ -0,0 +1,15 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Disposable } from 'vs/base/common/lifecycle';
import type { IHoverService } from 'vs/platform/hover/browser/hover';
export const NullHoverService: IHoverService = {
_serviceBrand: undefined,
hideHover: () => undefined,
showHover: () => undefined,
setupUpdatableHover: () => Disposable.None as any,
showAndFocusLastHover: () => undefined,
};

View file

@ -7,7 +7,6 @@ import { isActiveDocument, reset } from 'vs/base/browser/dom';
import { BaseActionViewItem, IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { IAction, SubmenuAction } from 'vs/base/common/actions';
import { Codicon } from 'vs/base/common/codicons';
@ -22,6 +21,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IHoverService } from 'vs/platform/hover/browser/hover';
export class CommandCenterControl {
@ -82,6 +82,7 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
private readonly _submenu: SubmenuItemAction,
private readonly _windowTitle: WindowTitle,
options: IBaseActionViewItemOptions,
@IHoverService private readonly _hoverService: IHoverService,
@IKeybindingService private _keybindingService: IKeybindingService,
@IInstantiationService private _instaService: IInstantiationService,
@IEditorGroupsService private _editorGroupService: IEditorGroupsService,
@ -95,7 +96,7 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
container.classList.add('command-center-center');
container.classList.toggle('multiple', (this._submenu.actions.length > 1));
const hover = this._store.add(setupCustomHover(this._hoverDelegate, container, this.getTooltip()));
const hover = this._store.add(this._hoverService.setupUpdatableHover(this._hoverDelegate, container, this.getTooltip()));
// update label & tooltip when window title changes
this._store.add(this._windowTitle.onDidChange(() => {
@ -156,7 +157,7 @@ class CommandCenterCenterViewItem extends BaseActionViewItem {
labelElement.innerText = label;
reset(container, searchIcon, labelElement);
const hover = this._store.add(setupCustomHover(that._hoverDelegate, container, this.getTooltip()));
const hover = this._store.add(that._hoverService.setupUpdatableHover(that._hoverDelegate, container, this.getTooltip()));
// update label & tooltip when window title changes
this._store.add(that._windowTitle.onDidChange(() => {

View file

@ -34,8 +34,8 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions, IConfigurationMigrationRegistry } from 'vs/workbench/common/configuration';
import { LOG_MODE_ID, OUTPUT_MODE_ID } from 'vs/workbench/services/output/common/output';
import { SEARCH_RESULT_LANGUAGE_ID } from 'vs/workbench/services/search/common/search';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const $ = dom.$;
@ -73,6 +73,7 @@ export class EmptyTextEditorHintContribution implements IEditorContribution {
@IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService,
@ICommandService private readonly commandService: ICommandService,
@IConfigurationService protected readonly configurationService: IConfigurationService,
@IHoverService protected readonly hoverService: IHoverService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IInlineChatSessionService private readonly inlineChatSessionService: IInlineChatSessionService,
@IInlineChatService protected readonly inlineChatService: IInlineChatService,
@ -159,6 +160,7 @@ export class EmptyTextEditorHintContribution implements IEditorContribution {
this.editorGroupsService,
this.commandService,
this.configurationService,
this.hoverService,
this.keybindingService,
this.inlineChatService,
this.telemetryService,
@ -191,6 +193,7 @@ class EmptyTextEditorHintContentWidget implements IContentWidget {
private readonly editorGroupsService: IEditorGroupsService,
private readonly commandService: ICommandService,
private readonly configurationService: IConfigurationService,
private readonly hoverService: IHoverService,
private readonly keybindingService: IKeybindingService,
private readonly inlineChatService: IInlineChatService,
private readonly telemetryService: ITelemetryService,
@ -384,7 +387,7 @@ class EmptyTextEditorHintContentWidget implements IContentWidget {
anchor.style.cursor = 'pointer';
const id = keybindingsLookup.shift();
const title = id && this.keybindingService.lookupKeybinding(id)?.getLabel();
hintHandler.disposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), anchor, title ?? ''));
hintHandler.disposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), anchor, title ?? ''));
}
return { hintElement, ariaLabel };

View file

@ -30,8 +30,8 @@ import { ICommentThreadWidget } from 'vs/workbench/contrib/comments/common/comme
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
import { LayoutableEditor, MIN_EDITOR_HEIGHT, SimpleCommentEditor, calculateEditorHeight } from './simpleCommentEditor';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const COMMENT_SCHEME = 'comment';
let INMEM_MODEL_ID = 0;
@ -67,7 +67,8 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
@IModelService private modelService: IModelService,
@IThemeService private themeService: IThemeService,
@IConfigurationService configurationService: IConfigurationService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService private keybindingService: IKeybindingService,
@IHoverService private hoverService: IHoverService,
) {
super();
@ -357,7 +358,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
private createReplyButton(commentEditor: ICodeEditor, commentForm: HTMLElement) {
this._reviewThreadReplyButton = <HTMLButtonElement>dom.append(commentForm, dom.$(`button.review-thread-reply-button.${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), this._reviewThreadReplyButton, this._commentOptions?.prompt || nls.localize('reply', "Reply...")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), this._reviewThreadReplyButton, this._commentOptions?.prompt || nls.localize('reply', "Reply...")));
this._reviewThreadReplyButton.textContent = this._commentOptions?.prompt || nls.localize('reply', "Reply...");
// bind click/escape actions for reviewThreadReplyButton and textArea

View file

@ -8,7 +8,6 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { HighlightedLabel, IHighlight } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { IInputValidationOptions, InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { IAsyncDataSource, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
import { Codicon } from 'vs/base/common/codicons';
@ -20,6 +19,7 @@ import { ThemeIcon } from 'vs/base/common/themables';
import { localize } from 'vs/nls';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { defaultInputBoxStyles } from 'vs/platform/theme/browser/defaultStyles';
import { COPY_EVALUATE_PATH_ID, COPY_VALUE_ID } from 'vs/workbench/contrib/debug/browser/debugCommands';
import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector';
@ -61,7 +61,7 @@ export function renderViewTree(container: HTMLElement): HTMLElement {
return treeContainer;
}
export function renderExpressionValue(expressionOrValue: IExpressionValue | string, container: HTMLElement, options: IRenderValueOptions): void {
export function renderExpressionValue(expressionOrValue: IExpressionValue | string, container: HTMLElement, options: IRenderValueOptions, hoverService: IHoverService): void {
let value = typeof expressionOrValue === 'string' ? expressionOrValue : expressionOrValue.value;
// remove stale classes
@ -109,7 +109,7 @@ export function renderExpressionValue(expressionOrValue: IExpressionValue | stri
if (options.hover) {
const { store, commands, commandService } = options.hover instanceof DisposableStore ? { store: options.hover, commands: [], commandService: undefined } : options.hover;
store.add(setupCustomHover(getDefaultHoverDelegate('mouse'), container, () => {
store.add(hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), container, () => {
const container = dom.$('div');
const markdownHoverElement = dom.$('div.hover-row');
const hoverContentsElement = dom.append(markdownHoverElement, dom.$('div.hover-contents'));
@ -130,7 +130,7 @@ export function renderExpressionValue(expressionOrValue: IExpressionValue | stri
}
}
export function renderVariable(store: DisposableStore, commandService: ICommandService, variable: Variable, data: IVariableTemplateData, showChanged: boolean, highlights: IHighlight[], linkDetector?: LinkDetector): void {
export function renderVariable(store: DisposableStore, commandService: ICommandService, hoverService: IHoverService, variable: Variable, data: IVariableTemplateData, showChanged: boolean, highlights: IHighlight[], linkDetector?: LinkDetector): void {
if (variable.available) {
let text = variable.name;
if (variable.value && typeof variable.name === 'string') {
@ -157,7 +157,7 @@ export function renderVariable(store: DisposableStore, commandService: ICommandS
hover: { store, commands, commandService },
colorize: true,
linkDetector
});
}, hoverService);
}
export interface IInputBoxOptions {
@ -217,6 +217,7 @@ export abstract class AbstractExpressionsRenderer<T = IExpression> implements IT
constructor(
@IDebugService protected debugService: IDebugService,
@IContextViewService private readonly contextViewService: IContextViewService,
@IHoverService protected readonly hoverService: IHoverService,
) { }
abstract get templateId(): string;
@ -227,7 +228,7 @@ export abstract class AbstractExpressionsRenderer<T = IExpression> implements IT
const name = dom.append(expression, $('span.name'));
const lazyButton = dom.append(expression, $('span.lazy-button'));
lazyButton.classList.add(...ThemeIcon.asClassNameArray(Codicon.eye));
templateDisposable.add(setupCustomHover(getDefaultHoverDelegate('mouse'), lazyButton, localize('debug.lazyButton.tooltip', "Click to expand")));
templateDisposable.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), lazyButton, localize('debug.lazyButton.tooltip', "Click to expand")));
const value = dom.append(expression, $('span.value'));
const label = templateDisposable.add(new HighlightedLabel(name));

View file

@ -22,8 +22,8 @@ import { BaseActionViewItem, IBaseActionViewItemOptions, SelectActionViewItem }
import { debugStart } from 'vs/workbench/contrib/debug/browser/debugIcons';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { defaultSelectBoxStyles } from 'vs/platform/theme/browser/defaultStyles';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const $ = dom.$;
@ -48,7 +48,8 @@ export class StartDebugActionViewItem extends BaseActionViewItem {
@ICommandService private readonly commandService: ICommandService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IContextViewService contextViewService: IContextViewService,
@IKeybindingService private readonly keybindingService: IKeybindingService
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IHoverService private readonly hoverService: IHoverService
) {
super(context, action, options);
this.toDispose = [];
@ -77,7 +78,7 @@ export class StartDebugActionViewItem extends BaseActionViewItem {
const keybinding = this.keybindingService.lookupKeybinding(this.action.id)?.getLabel();
const keybindingLabel = keybinding ? ` (${keybinding})` : '';
const title = this.action.label + keybindingLabel;
this.toDispose.push(setupCustomHover(getDefaultHoverDelegate('mouse'), this.start, title));
this.toDispose.push(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), this.start, title));
this.start.setAttribute('role', 'button');
this.start.ariaLabel = title;

View file

@ -28,6 +28,7 @@ import * as nls from 'vs/nls';
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
import { ILogService } from 'vs/platform/log/common/log';
@ -110,6 +111,7 @@ export class DebugHoverWidget implements IContentWidget {
@IMenuService private readonly menuService: IMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IHoverService private readonly hoverService: IHoverService,
) {
this.toDispose = [];
@ -289,7 +291,7 @@ export class DebugHoverWidget implements IContentWidget {
renderExpressionValue(expression, this.valueContainer, {
showChanged: false,
colorize: true
});
}, this.hoverService);
this.valueContainer.title = '';
this.editor.layoutContentWidget(this);
this.scrollbar.scanDomNode();

View file

@ -625,8 +625,8 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
this.instantiationService.createInstance(ReplOutputElementRenderer, linkDetector),
new ReplEvaluationInputsRenderer(),
this.instantiationService.createInstance(ReplGroupRenderer, linkDetector),
new ReplEvaluationResultsRenderer(linkDetector),
new ReplRawObjectsRenderer(linkDetector),
new ReplEvaluationResultsRenderer(linkDetector, this.hoverService),
new ReplRawObjectsRenderer(linkDetector, this.hoverService),
],
// https://github.com/microsoft/TypeScript/issues/32526
new ReplDataSource() satisfies IAsyncDataSource<IDebugSession, IReplElement>,

View file

@ -28,9 +28,9 @@ import { IDebugConfiguration, IDebugService, IDebugSession, IExpression, IExpres
import { Variable } from 'vs/workbench/contrib/debug/common/debugModel';
import { RawObjectReplElement, ReplEvaluationInput, ReplEvaluationResult, ReplGroup, ReplOutputElement, ReplVariableElement } from 'vs/workbench/contrib/debug/common/replModel';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const $ = dom.$;
@ -125,7 +125,10 @@ export class ReplEvaluationResultsRenderer implements ITreeRenderer<ReplEvaluati
return ReplEvaluationResultsRenderer.ID;
}
constructor(private readonly linkDetector: LinkDetector) { }
constructor(
private readonly linkDetector: LinkDetector,
private readonly hoverService: IHoverService
) { }
renderTemplate(container: HTMLElement): IReplEvaluationResultTemplateData {
const output = dom.append(container, $('.evaluation-result.expression'));
@ -139,7 +142,7 @@ export class ReplEvaluationResultsRenderer implements ITreeRenderer<ReplEvaluati
renderExpressionValue(expression, templateData.value, {
colorize: true,
linkDetector: this.linkDetector
});
}, this.hoverService);
}
disposeTemplate(templateData: IReplEvaluationResultTemplateData): void {
@ -153,6 +156,7 @@ export class ReplOutputElementRenderer implements ITreeRenderer<ReplOutputElemen
constructor(
private readonly linkDetector: LinkDetector,
@IEditorService private readonly editorService: IEditorService,
@IHoverService private readonly hoverService: IHoverService,
@ILabelService private readonly labelService: ILabelService,
@IThemeService private readonly themeService: IThemeService
) { }
@ -201,7 +205,7 @@ export class ReplOutputElementRenderer implements ITreeRenderer<ReplOutputElemen
templateData.value.classList.add((element.severity === severity.Warning) ? 'warn' : (element.severity === severity.Error) ? 'error' : (element.severity === severity.Ignore) ? 'ignore' : 'info');
templateData.source.textContent = element.sourceData ? `${basename(element.sourceData.source.name)}:${element.sourceData.lineNumber}` : '';
templateData.toDispose.push(setupCustomHover(getDefaultHoverDelegate('mouse'), templateData.source, element.sourceData ? `${this.labelService.getUriLabel(element.sourceData.source.uri)}:${element.sourceData.lineNumber}` : ''));
templateData.toDispose.push(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), templateData.source, element.sourceData ? `${this.labelService.getUriLabel(element.sourceData.source.uri)}:${element.sourceData.lineNumber}` : ''));
templateData.getReplElementSource = () => element.sourceData;
}
@ -236,8 +240,9 @@ export class ReplVariablesRenderer extends AbstractExpressionsRenderer<IExpressi
@IDebugService debugService: IDebugService,
@IContextViewService contextViewService: IContextViewService,
@ICommandService private readonly commandService: ICommandService,
@IHoverService hoverService: IHoverService
) {
super(debugService, contextViewService);
super(debugService, contextViewService, hoverService);
}
public renderElement(node: ITreeNode<IExpression | ReplVariableElement, FuzzyScore>, _index: number, data: IExpressionTemplateData): void {
@ -249,10 +254,10 @@ export class ReplVariablesRenderer extends AbstractExpressionsRenderer<IExpressi
const isReplVariable = expression instanceof ReplVariableElement;
if (isReplVariable || !expression.name) {
data.label.set('');
renderExpressionValue(isReplVariable ? expression.expression : expression, data.value, { colorize: true, linkDetector: this.linkDetector });
renderExpressionValue(isReplVariable ? expression.expression : expression, data.value, { colorize: true, linkDetector: this.linkDetector }, this.hoverService);
data.expression.classList.remove('nested-variable');
} else {
renderVariable(data.elementDisposable, this.commandService, expression as Variable, data, true, highlights, this.linkDetector);
renderVariable(data.elementDisposable, this.commandService, this.hoverService, expression as Variable, data, true, highlights, this.linkDetector);
data.expression.classList.toggle('nested-variable', isNestedVariable(expression));
}
}
@ -265,7 +270,10 @@ export class ReplVariablesRenderer extends AbstractExpressionsRenderer<IExpressi
export class ReplRawObjectsRenderer implements ITreeRenderer<RawObjectReplElement, FuzzyScore, IRawObjectReplTemplateData> {
static readonly ID = 'rawObject';
constructor(private readonly linkDetector: LinkDetector) { }
constructor(
private readonly linkDetector: LinkDetector,
private readonly hoverService: IHoverService
) { }
get templateId(): string {
return ReplRawObjectsRenderer.ID;
@ -295,7 +303,7 @@ export class ReplRawObjectsRenderer implements ITreeRenderer<RawObjectReplElemen
// value
renderExpressionValue(element.value, templateData.value, {
linkDetector: this.linkDetector
});
}, this.hoverService);
}
disposeTemplate(templateData: IRawObjectReplTemplateData): void {

View file

@ -445,10 +445,11 @@ export class VisualizedVariableRenderer extends AbstractExpressionsRenderer {
private readonly linkDetector: LinkDetector,
@IDebugService debugService: IDebugService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService hoverService: IHoverService,
@IMenuService private readonly menuService: IMenuService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
) {
super(debugService, contextViewService);
super(debugService, contextViewService, hoverService);
}
public override get templateId(): string {
@ -473,7 +474,7 @@ export class VisualizedVariableRenderer extends AbstractExpressionsRenderer {
hover: data.elementDisposable,
colorize: true,
linkDetector: this.linkDetector
});
}, this.hoverService);
}
protected override getInputBoxOptions(expression: IExpression): IInputBoxOptions | undefined {
@ -531,8 +532,9 @@ export class VariablesRenderer extends AbstractExpressionsRenderer {
@ICommandService private readonly commandService: ICommandService,
@IDebugService debugService: IDebugService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService hoverService: IHoverService,
) {
super(debugService, contextViewService);
super(debugService, contextViewService, hoverService);
}
get templateId(): string {
@ -540,7 +542,7 @@ export class VariablesRenderer extends AbstractExpressionsRenderer {
}
protected renderExpression(expression: IExpression, data: IExpressionTemplateData, highlights: IHighlight[]): void {
renderVariable(data.elementDisposable, this.commandService, expression as Variable, data, true, highlights, this.linkDetector);
renderVariable(data.elementDisposable, this.commandService, this.hoverService, expression as Variable, data, true, highlights, this.linkDetector);
}
public override renderElement(node: ITreeNode<IExpression, FuzzyScore>, index: number, data: IExpressionTemplateData): void {

View file

@ -285,8 +285,9 @@ class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IDebugService debugService: IDebugService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService hoverService: IHoverService,
) {
super(debugService, contextViewService);
super(debugService, contextViewService, hoverService);
}
get templateId() {
@ -314,7 +315,7 @@ class WatchExpressionsRenderer extends AbstractExpressionsRenderer {
maxValueLength: MAX_VALUE_RENDER_LENGTH_IN_VIEWLET,
hover: data.elementDisposable,
colorize: true
});
}, this.hoverService);
}
protected getInputBoxOptions(expression: IExpression, settingValue: boolean): IInputBoxOptions {

View file

@ -10,6 +10,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
import { isWindows } from 'vs/base/common/platform';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { NullCommandService } from 'vs/platform/commands/test/common/nullCommandService';
import { NullHoverService } from 'vs/platform/hover/test/browser/nullHoverService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { renderExpressionValue, renderVariable, renderViewTree } from 'vs/workbench/contrib/debug/browser/baseDebugView';
import { LinkDetector } from 'vs/workbench/contrib/debug/browser/linkDetector';
@ -46,37 +47,37 @@ suite('Debug - Base Debug View', () => {
test('render expression value', () => {
let container = $('.container');
renderExpressionValue('render \n me', container, {});
renderExpressionValue('render \n me', container, {}, NullHoverService);
assert.strictEqual(container.className, 'value');
assert.strictEqual(container.textContent, 'render \n me');
const expression = new Expression('console');
expression.value = 'Object';
container = $('.container');
renderExpressionValue(expression, container, { colorize: true });
renderExpressionValue(expression, container, { colorize: true }, NullHoverService);
assert.strictEqual(container.className, 'value unavailable error');
expression.available = true;
expression.value = '"string value"';
container = $('.container');
renderExpressionValue(expression, container, { colorize: true, linkDetector });
renderExpressionValue(expression, container, { colorize: true, linkDetector }, NullHoverService);
assert.strictEqual(container.className, 'value string');
assert.strictEqual(container.textContent, '"string value"');
expression.type = 'boolean';
container = $('.container');
renderExpressionValue(expression, container, { colorize: true });
renderExpressionValue(expression, container, { colorize: true }, NullHoverService);
assert.strictEqual(container.className, 'value boolean');
assert.strictEqual(container.textContent, expression.value);
expression.value = 'this is a long string';
container = $('.container');
renderExpressionValue(expression, container, { colorize: true, maxValueLength: 4, linkDetector });
renderExpressionValue(expression, container, { colorize: true, maxValueLength: 4, linkDetector }, NullHoverService);
assert.strictEqual(container.textContent, 'this...');
expression.value = isWindows ? 'C:\\foo.js:5' : '/foo.js:5';
container = $('.container');
renderExpressionValue(expression, container, { colorize: true, linkDetector });
renderExpressionValue(expression, container, { colorize: true, linkDetector }, NullHoverService);
assert.ok(container.querySelector('a'));
assert.strictEqual(container.querySelector('a')!.textContent, expression.value);
});
@ -94,7 +95,7 @@ suite('Debug - Base Debug View', () => {
const label = new HighlightedLabel(name);
const lazyButton = $('.');
const store = disposables.add(new DisposableStore());
renderVariable(store, NullCommandService, variable, { expression, name, value, label, lazyButton }, false, []);
renderVariable(store, NullCommandService, NullHoverService, variable, { expression, name, value, label, lazyButton }, false, []);
assert.strictEqual(label.element.textContent, 'foo');
assert.strictEqual(value.textContent, '');
@ -103,7 +104,7 @@ suite('Debug - Base Debug View', () => {
expression = $('.');
name = $('.');
value = $('.');
renderVariable(store, NullCommandService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
renderVariable(store, NullCommandService, NullHoverService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
assert.strictEqual(value.textContent, 'hey');
assert.strictEqual(label.element.textContent, 'foo:');
@ -111,7 +112,7 @@ suite('Debug - Base Debug View', () => {
expression = $('.');
name = $('.');
value = $('.');
renderVariable(store, NullCommandService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
renderVariable(store, NullCommandService, NullHoverService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
assert.ok(value.querySelector('a'));
assert.strictEqual(value.querySelector('a')!.textContent, variable.value);
@ -119,7 +120,7 @@ suite('Debug - Base Debug View', () => {
expression = $('.');
name = $('.');
value = $('.');
renderVariable(store, NullCommandService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
renderVariable(store, NullCommandService, NullHoverService, variable, { expression, name, value, label, lazyButton }, false, [], linkDetector);
assert.strictEqual(name.className, 'virtual');
assert.strictEqual(label.element.textContent, 'console:');
assert.strictEqual(value.className, 'value number');

View file

@ -6,7 +6,6 @@
import { $, Dimension, addDisposableListener, append, clearNode } from 'vs/base/browser/dom';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { IListRenderer, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
@ -25,6 +24,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ExtensionIdentifier, ExtensionIdentifierMap, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ILabelService } from 'vs/platform/label/common/label';
import { WorkbenchList } from 'vs/platform/list/browser/listService';
@ -92,6 +92,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
@IClipboardService private readonly _clipboardService: IClipboardService,
@IExtensionFeaturesManagementService private readonly _extensionFeaturesManagementService: IExtensionFeaturesManagementService,
@IHoverService private readonly _hoverService: IHoverService,
) {
super(AbstractRuntimeExtensionsEditor.ID, group, telemetryService, themeService, storageService);
@ -368,14 +369,14 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
} else {
title = nls.localize('extensionActivating', "Extension is activating...");
}
data.elementDisposables.push(setupCustomHover(getDefaultHoverDelegate('mouse'), data.activationTime, title));
data.elementDisposables.push(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), data.activationTime, title));
clearNode(data.msgContainer);
if (this._getUnresponsiveProfile(element.description.identifier)) {
const el = $('span', undefined, ...renderLabelWithIcons(` $(alert) Unresponsive`));
const extensionHostFreezTitle = nls.localize('unresponsive.title', "Extension has caused the extension host to freeze.");
data.elementDisposables.push(setupCustomHover(getDefaultHoverDelegate('mouse'), el, extensionHostFreezTitle));
data.elementDisposables.push(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), el, extensionHostFreezTitle));
data.msgContainer.appendChild(el);
}
@ -423,7 +424,7 @@ export abstract class AbstractRuntimeExtensionsEditor extends EditorPane {
if (accessData?.current) {
const element = $('span', undefined, nls.localize('requests count', "{0} Requests: {1} (Session)", feature.label, accessData.current.count));
const title = nls.localize('requests count title', "Last request was {0}. Overall Requests: {1}", fromNow(accessData.current.lastAccessed, true, true), accessData.totalCount);
data.elementDisposables.push(setupCustomHover(getDefaultHoverDelegate('mouse'), element, title));
data.elementDisposables.push(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), element, title));
data.msgContainer.appendChild(element);
}

View file

@ -6,7 +6,6 @@
import { $, Dimension, addDisposableListener, append, setParentFlowTo } from 'vs/base/browser/dom';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { CheckboxActionViewItem } from 'vs/base/browser/ui/toggle/toggle';
import { Action, IAction } from 'vs/base/common/actions';
@ -91,6 +90,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b
import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
import { VIEW_ID as EXPLORER_VIEW_ID } from 'vs/workbench/contrib/files/common/files';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { IHoverService } from 'vs/platform/hover/browser/hover';
class NavBar extends Disposable {
@ -195,10 +195,13 @@ abstract class ExtensionWithDifferentGalleryVersionWidget extends ExtensionWidge
class VersionWidget extends ExtensionWithDifferentGalleryVersionWidget {
private readonly element: HTMLElement;
constructor(container: HTMLElement) {
constructor(
container: HTMLElement,
hoverService: IHoverService
) {
super();
this.element = append(container, $('code.version'));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), this.element, localize('extension version', "Extension Version")));
this._register(hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), this.element, localize('extension version', "Extension Version")));
this.render();
}
render(): void {
@ -255,6 +258,7 @@ export class ExtensionEditor extends EditorPane {
@IExplorerService private readonly explorerService: IExplorerService,
@IViewsService private readonly viewsService: IViewsService,
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
@IHoverService private readonly hoverService: IHoverService,
) {
super(ExtensionEditor.ID, group, telemetryService, themeService, storageService);
this.extensionReadme = null;
@ -284,11 +288,11 @@ export class ExtensionEditor extends EditorPane {
const details = append(header, $('.details'));
const title = append(details, $('.title'));
const name = append(title, $('span.name.clickable', { role: 'heading', tabIndex: 0 }));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), name, localize('name', "Extension name")));
const versionWidget = new VersionWidget(title);
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), name, localize('name', "Extension name")));
const versionWidget = new VersionWidget(title, this.hoverService);
const preview = append(title, $('span.preview'));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), preview, localize('preview', "Preview")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), preview, localize('preview', "Preview")));
preview.textContent = localize('preview', "Preview");
const builtin = append(title, $('span.builtin'));
@ -296,7 +300,7 @@ export class ExtensionEditor extends EditorPane {
const subtitle = append(details, $('.subtitle'));
const publisher = append(append(subtitle, $('.subtitle-entry')), $('.publisher.clickable', { tabIndex: 0 }));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), publisher, localize('publisher', "Publisher")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), publisher, localize('publisher', "Publisher")));
publisher.setAttribute('role', 'button');
const publisherDisplayName = append(publisher, $('.publisher-name'));
const verifiedPublisherWidget = this.instantiationService.createInstance(VerifiedPublisherWidget, append(publisher, $('.verified-publisher')), false);
@ -305,11 +309,11 @@ export class ExtensionEditor extends EditorPane {
resource.setAttribute('role', 'button');
const installCount = append(append(subtitle, $('.subtitle-entry')), $('span.install', { tabIndex: 0 }));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), installCount, localize('install count', "Install count")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), installCount, localize('install count', "Install count")));
const installCountWidget = this.instantiationService.createInstance(InstallCountWidget, installCount, false);
const rating = append(append(subtitle, $('.subtitle-entry')), $('span.rating.clickable', { tabIndex: 0 }));
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), rating, localize('rating', "Rating")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), rating, localize('rating', "Rating")));
rating.setAttribute('role', 'link'); // #132645
const ratingsWidget = this.instantiationService.createInstance(RatingsWidget, rating, false);
@ -549,14 +553,14 @@ export class ExtensionEditor extends EditorPane {
const workspaceFolder = this.contextService.getWorkspaceFolder(location);
if (workspaceFolder && extension.isWorkspaceScoped) {
template.resource.parentElement?.classList.add('clickable');
this.transientDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), template.resource, this.uriIdentityService.extUri.relativePath(workspaceFolder.uri, location)));
this.transientDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), template.resource, this.uriIdentityService.extUri.relativePath(workspaceFolder.uri, location)));
template.resource.textContent = localize('workspace extension', "Workspace Extension");
this.transientDisposables.add(onClick(template.resource, () => {
this.viewsService.openView(EXPLORER_VIEW_ID, true).then(() => this.explorerService.select(location, true));
}));
} else {
template.resource.parentElement?.classList.remove('clickable');
this.transientDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), template.resource, location.path));
this.transientDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), template.resource, location.path));
template.resource.textContent = localize('local extension', "Local Extension");
}
}
@ -965,7 +969,7 @@ export class ExtensionEditor extends EditorPane {
for (const [label, uri] of resources) {
const resource = append(resourcesElement, $('a.resource', { tabindex: '0' }, label));
this.transientDisposables.add(onClick(resource, () => this.openerService.open(uri)));
this.transientDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), resource, uri.toString()));
this.transientDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), resource, uri.toString()));
}
}
}

View file

@ -31,6 +31,7 @@ import { Schemas } from 'vs/base/common/network';
import { joinPath } from 'vs/base/common/resources';
import { IExtensionFeaturesManagementService } from 'vs/workbench/services/extensionManagement/common/extensionFeatures';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IHoverService } from 'vs/platform/hover/browser/hover';
export const IExtensionHostProfileService = createDecorator<IExtensionHostProfileService>('extensionHostProfileService');
export const CONTEXT_PROFILE_SESSION_STATE = new RawContextKey<string>('profileSessionState', 'none');
@ -81,8 +82,9 @@ export class RuntimeExtensionsEditor extends AbstractRuntimeExtensionsEditor {
@IClipboardService clipboardService: IClipboardService,
@IExtensionHostProfileService private readonly _extensionHostProfileService: IExtensionHostProfileService,
@IExtensionFeaturesManagementService extensionFeaturesManagementService: IExtensionFeaturesManagementService,
@IHoverService hoverService: IHoverService
) {
super(group, telemetryService, themeService, contextKeyService, extensionsWorkbenchService, extensionService, notificationService, contextMenuService, instantiationService, storageService, labelService, environmentService, clipboardService, extensionFeaturesManagementService);
super(group, telemetryService, themeService, contextKeyService, extensionsWorkbenchService, extensionService, notificationService, contextMenuService, instantiationService, storageService, labelService, environmentService, clipboardService, extensionFeaturesManagementService, hoverService);
this._profileInfo = this._extensionHostProfileService.lastProfile;
this._extensionsHostRecorded = CONTEXT_EXTENSION_HOST_PROFILE_RECORDED.bindTo(contextKeyService);
this._profileSessionState = CONTEXT_PROFILE_SESSION_STATE.bindTo(contextKeyService);

View file

@ -52,9 +52,9 @@ import { ICodeEditorWidgetOptions } from 'vs/editor/browser/widget/codeEditor/co
import { SnippetController2 } from 'vs/editor/contrib/snippet/browser/snippetController2';
import { SuggestController } from 'vs/editor/contrib/suggest/browser/suggestController';
import { IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IHoverService } from 'vs/platform/hover/browser/hover';
export interface InlineChatWidgetViewState {
@ -156,6 +156,7 @@ export class InlineChatWidget {
@IAccessibleViewService private readonly _accessibleViewService: IAccessibleViewService,
@ITextModelService protected readonly _textModelResolverService: ITextModelService,
@IChatService private readonly _chatService: IChatService,
@IHoverService private readonly _hoverService: IHoverService,
) {
// toolbars
this._progressBar = new ProgressBar(this._elements.progress);
@ -295,7 +296,7 @@ export class InlineChatWidget {
this._updateAriaLabel();
// this._elements.status
this._store.add(setupCustomHover(getDefaultHoverDelegate('element'), this._elements.statusLabel, () => {
this._store.add(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('element'), this._elements.statusLabel, () => {
return this._elements.statusLabel.dataset['title'];
}));
@ -650,8 +651,9 @@ export class EditorBasedInlineChatWidget extends InlineChatWidget {
@IAccessibleViewService accessibleViewService: IAccessibleViewService,
@ITextModelService textModelResolverService: ITextModelService,
@IChatService chatService: IChatService,
@IHoverService hoverService: IHoverService,
) {
super(ChatAgentLocation.Editor, { ...options, editorOverflowWidgetsDomNode: _parentEditor.getOverflowWidgetsDomNode() }, instantiationService, contextKeyService, keybindingService, accessibilityService, configurationService, accessibleViewService, textModelResolverService, chatService);
super(ChatAgentLocation.Editor, { ...options, editorOverflowWidgetsDomNode: _parentEditor.getOverflowWidgetsDomNode() }, instantiationService, contextKeyService, keybindingService, accessibilityService, configurationService, accessibleViewService, textModelResolverService, chatService, hoverService);
// preview editors
this._previewDiffEditor = new Lazy(() => this._store.add(instantiationService.createInstance(EmbeddedDiffEditorWidget, this._elements.previewDiff, {

View file

@ -8,6 +8,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorContributionInstantiation, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IProductService } from 'vs/platform/product/common/productService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@ -26,6 +27,7 @@ export class EmptyCellEditorHintContribution extends EmptyTextEditorHintContribu
@IEditorGroupsService editorGroupsService: IEditorGroupsService,
@ICommandService commandService: ICommandService,
@IConfigurationService configurationService: IConfigurationService,
@IHoverService hoverService: IHoverService,
@IKeybindingService keybindingService: IKeybindingService,
@IInlineChatSessionService inlineChatSessionService: IInlineChatSessionService,
@IInlineChatService inlineChatService: IInlineChatService,
@ -37,6 +39,7 @@ export class EmptyCellEditorHintContribution extends EmptyTextEditorHintContribu
editorGroupsService,
commandService,
configurationService,
hoverService,
keybindingService,
inlineChatSessionService,
inlineChatService,

View file

@ -10,6 +10,7 @@ import { ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/tree/tree';
import { FuzzyScore } from 'vs/base/common/filters';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { WorkbenchObjectTree } from 'vs/platform/list/browser/listService';
import { renderExpressionValue } from 'vs/workbench/contrib/debug/browser/baseDebugView';
import { INotebookVariableElement } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource';
@ -45,6 +46,11 @@ export class NotebookVariableRenderer implements ITreeRenderer<INotebookVariable
return NotebookVariableRenderer.ID;
}
constructor(
@IHoverService private readonly _hoverService: IHoverService
) {
}
renderTemplate(container: HTMLElement): IVariableTemplateData {
const expression = dom.append(container, $('.expression'));
const name = dom.append(expression, $('span.name'));
@ -64,7 +70,7 @@ export class NotebookVariableRenderer implements ITreeRenderer<INotebookVariable
colorize: true,
hover: data.elementDisposables,
maxValueLength: MAX_VALUE_RENDER_LENGTH_IN_VIEWLET
});
}, this._hoverService);
}
disposeElement(element: ITreeNode<INotebookVariableElement, FuzzyScore>, index: number, templateData: IVariableTemplateData, height: number | undefined): void {

View file

@ -88,7 +88,7 @@ export class NotebookVariablesView extends ViewPane {
'notebookVariablesTree',
container,
new NotebookVariablesDelegate(),
[new NotebookVariableRenderer()],
[new NotebookVariableRenderer(this.hoverService)],
this.dataSource,
{
accessibilityProvider: new NotebookVariableAccessibilityProvider(),

View file

@ -69,8 +69,8 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ISetting, ISettingsGroup, SettingValueType } from 'vs/workbench/services/preferences/common/preferences';
import { getInvalidTypeError } from 'vs/workbench/services/preferences/common/preferencesValidation';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const $ = DOM.$;
@ -770,6 +770,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
@IExtensionsWorkbenchService protected readonly _extensionsWorkbenchService: IExtensionsWorkbenchService,
@IProductService protected readonly _productService: IProductService,
@ITelemetryService protected readonly _telemetryService: ITelemetryService,
@IHoverService protected readonly _hoverService: IHoverService,
) {
super();
@ -804,7 +805,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
const descriptionElement = DOM.append(container, $('.setting-item-description'));
const modifiedIndicatorElement = DOM.append(container, $('.setting-item-modified-indicator'));
toDispose.add(setupCustomHover(getDefaultHoverDelegate('mouse'), modifiedIndicatorElement, () => localize('modified', "The setting has been configured in the current scope.")));
toDispose.add(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), modifiedIndicatorElement, () => localize('modified', "The setting has been configured in the current scope.")));
const valueElement = DOM.append(container, $('.setting-item-value'));
const controlElement = DOM.append(valueElement, $('div.setting-item-control'));
@ -891,7 +892,7 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
const titleTooltip = setting.key + (element.isConfigured ? ' - Modified' : '');
template.categoryElement.textContent = element.displayCategory ? (element.displayCategory + ': ') : '';
template.elementDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), template.categoryElement, titleTooltip));
template.elementDisposables.add(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), template.categoryElement, titleTooltip));
template.labelElement.text = element.displayLabel;
template.labelElement.title = titleTooltip;
@ -1834,7 +1835,7 @@ export class SettingBoolRenderer extends AbstractSettingRenderer implements ITre
const controlElement = DOM.append(descriptionAndValueElement, $('.setting-item-bool-control'));
const descriptionElement = DOM.append(descriptionAndValueElement, $('.setting-item-description'));
const modifiedIndicatorElement = DOM.append(container, $('.setting-item-modified-indicator'));
toDispose.add(setupCustomHover(getDefaultHoverDelegate('mouse'), modifiedIndicatorElement, localize('modified', "The setting has been configured in the current scope.")));
toDispose.add(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), modifiedIndicatorElement, localize('modified', "The setting has been configured in the current scope.")));
const deprecationWarningElement = DOM.append(container, $('.setting-item-deprecation-message'));

View file

@ -27,8 +27,8 @@ import { ThemeIcon } from 'vs/base/common/themables';
import { settingsDiscardIcon, settingsEditIcon, settingsRemoveIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
import { settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground } from 'vs/workbench/contrib/preferences/common/settingsEditorColorRegistry';
import { defaultButtonStyles, getInputBoxStyle, getSelectBoxStyles } from 'vs/platform/theme/browser/defaultStyles';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const $ = DOM.$;
@ -412,6 +412,15 @@ export class ListSettingWidget extends AbstractListSettingWidget<IListDataItem>
super.setValue(listData);
}
constructor(
container: HTMLElement,
@IThemeService themeService: IThemeService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService protected readonly hoverService: IHoverService
) {
super(container, themeService, contextViewService);
}
protected getEmptyItem(): IListDataItem {
return {
value: {
@ -675,7 +684,7 @@ export class ListSettingWidget extends AbstractListSettingWidget<IListDataItem>
: localize('listSiblingHintLabel', "List item `{0}` with sibling `${1}`", value.data, sibling);
const { rowElement } = rowElementGroup;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), rowElement, title));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), rowElement, title));
rowElement.setAttribute('aria-label', title);
}
@ -735,7 +744,7 @@ export class ExcludeSettingWidget extends ListSettingWidget {
: localize('excludeSiblingHintLabel', "Exclude files matching `{0}`, only when a file matching `{1}` is present", value.data, sibling);
const { rowElement } = rowElementGroup;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), rowElement, title));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), rowElement, title));
rowElement.setAttribute('aria-label', title);
}
@ -765,7 +774,7 @@ export class IncludeSettingWidget extends ListSettingWidget {
: localize('includeSiblingHintLabel', "Include files matching `{0}`, only when a file matching `{1}` is present", value.data, sibling);
const { rowElement } = rowElementGroup;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), rowElement, title));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), rowElement, title));
rowElement.setAttribute('aria-label', title);
}
@ -841,6 +850,15 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
private keySuggester: IObjectKeySuggester = () => undefined;
private valueSuggester: IObjectValueSuggester = () => undefined;
constructor(
container: HTMLElement,
@IThemeService themeService: IThemeService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService private readonly hoverService: IHoverService,
) {
super(container, themeService, contextViewService);
}
override setValue(listData: IObjectDataItem[], options?: IObjectSetValueOptions): void {
this.showAddButton = options?.showAddButton ?? this.showAddButton;
this.keySuggester = options?.keySuggester ?? this.keySuggester;
@ -1163,10 +1181,10 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
const accessibleDescription = localize('objectPairHintLabel', "The property `{0}` is set to `{1}`.", item.key.data, item.value.data);
const keyDescription = this.getEnumDescription(item.key) ?? item.keyDescription ?? accessibleDescription;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), keyElement, keyDescription));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), keyElement, keyDescription));
const valueDescription = this.getEnumDescription(item.value) ?? accessibleDescription;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), valueElement!, valueDescription));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), valueElement!, valueDescription));
rowElement.setAttribute('aria-label', accessibleDescription);
}
@ -1197,6 +1215,15 @@ interface IBoolObjectSetValueOptions {
export class ObjectSettingCheckboxWidget extends AbstractListSettingWidget<IObjectDataItem> {
private currentSettingKey: string = '';
constructor(
container: HTMLElement,
@IThemeService themeService: IThemeService,
@IContextViewService contextViewService: IContextViewService,
@IHoverService private readonly hoverService: IHoverService,
) {
super(container, themeService, contextViewService);
}
override setValue(listData: IObjectDataItem[], options?: IBoolObjectSetValueOptions): void {
if (isDefined(options) && options.settingKey !== this.currentSettingKey) {
this.model.setEditKey('none');
@ -1317,7 +1344,7 @@ export class ObjectSettingCheckboxWidget extends AbstractListSettingWidget<IObje
const title = item.keyDescription ?? accessibleDescription;
const { rowElement, keyElement, valueElement } = rowElementGroup;
this.listDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), keyElement, title));
this.listDisposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), keyElement, title));
valueElement!.setAttribute('aria-label', accessibleDescription);
rowElement.setAttribute('aria-label', accessibleDescription);
}

View file

@ -5,7 +5,6 @@
import * as DOM from 'vs/base/browser/dom';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { DefaultStyleController, IListAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { RenderIndentGuides } from 'vs/base/browser/ui/tree/abstractTree';
@ -15,6 +14,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IListService, IWorkbenchObjectTreeOptions, WorkbenchObjectTree } from 'vs/platform/list/browser/listService';
import { getListStyles } from 'vs/platform/theme/browser/defaultStyles';
@ -112,6 +112,9 @@ export class TOCRenderer implements ITreeRenderer<SettingsTreeGroupElement, neve
templateId = TOC_ENTRY_TEMPLATE_ID;
constructor(private readonly _hoverService: IHoverService) {
}
renderTemplate(container: HTMLElement): ITOCEntryTemplate {
return {
labelElement: DOM.append(container, $('.settings-toc-entry')),
@ -128,7 +131,7 @@ export class TOCRenderer implements ITreeRenderer<SettingsTreeGroupElement, neve
const label = element.label;
template.labelElement.textContent = label;
template.elementDisposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), template.labelElement, label));
template.elementDisposables.add(this._hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), template.labelElement, label));
if (count) {
template.countElement.textContent = ` (${count})`;
@ -208,6 +211,7 @@ export class TOCTree extends WorkbenchObjectTree<SettingsTreeGroupElement> {
@IContextKeyService contextKeyService: IContextKeyService,
@IListService listService: IListService,
@IConfigurationService configurationService: IConfigurationService,
@IHoverService hoverService: IHoverService,
@IInstantiationService instantiationService: IInstantiationService,
) {
// test open mode
@ -233,7 +237,7 @@ export class TOCTree extends WorkbenchObjectTree<SettingsTreeGroupElement> {
'SettingsTOC',
container,
new TOCTreeDelegate(),
[new TOCRenderer()],
[new TOCRenderer(hoverService)],
options,
instantiationService,
contextKeyService,

View file

@ -106,7 +106,6 @@ 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 { 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';
@ -913,7 +912,9 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
constructor(
private actionRunner: IActionRunner,
private actionViewItemProvider: IActionViewItemProvider,
@ISCMViewService private scmViewService: ISCMViewService) { }
@IHoverService private hoverService: IHoverService,
@ISCMViewService private scmViewService: ISCMViewService
) { }
renderTemplate(container: HTMLElement): HistoryItemTemplate {
// hack
@ -934,7 +935,7 @@ class HistoryItemRenderer implements ICompressibleTreeRenderer<SCMHistoryItemTre
const insertionsLabel = append(statsContainer, $('.insertions-label'));
const deletionsLabel = append(statsContainer, $('.deletions-label'));
const statsCustomHover = setupCustomHover(getDefaultHoverDelegate('element'), statsContainer, '');
const statsCustomHover = this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('element'), statsContainer, '');
disposables.add(statsCustomHover);
return { iconContainer, label: iconLabel, actionBar, statsContainer, statsCustomHover, filesLabel, insertionsLabel, deletionsLabel, elementDisposables: new DisposableStore(), disposables };

View file

@ -30,8 +30,8 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { defaultCountBadgeStyles } from 'vs/platform/theme/browser/defaultStyles';
import { SearchContext } from 'vs/workbench/contrib/search/common/constants';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
interface IFolderMatchTemplate {
label: IResourceLabel;
@ -301,6 +301,7 @@ export class MatchRenderer extends Disposable implements ICompressibleTreeRender
@IConfigurationService private readonly configurationService: IConfigurationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IHoverService private readonly hoverService: IHoverService
) {
super();
}
@ -364,7 +365,7 @@ export class MatchRenderer extends Disposable implements ICompressibleTreeRender
templateData.after.textContent = preview.after;
const title = (preview.fullBefore + (replace ? match.replaceString : preview.inside) + preview.after).trim().substr(0, 999);
templateData.disposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), templateData.parent, title));
templateData.disposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), templateData.parent, title));
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!(match instanceof MatchInNotebook && match.isReadonly()));
@ -376,7 +377,7 @@ export class MatchRenderer extends Disposable implements ICompressibleTreeRender
templateData.lineNumber.classList.toggle('show', (numLines > 0) || showLineNumbers);
templateData.lineNumber.textContent = lineNumberStr + extraLinesStr;
templateData.disposables.add(setupCustomHover(getDefaultHoverDelegate('mouse'), templateData.lineNumber, this.getMatchTitle(match, showLineNumbers)));
templateData.disposables.add(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), templateData.lineNumber, this.getMatchTitle(match, showLineNumbers)));
templateData.actions.context = <ISearchActionContext>{ viewer: this.searchView.getControl(), element: match };

View file

@ -81,7 +81,6 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { ILogService } from 'vs/platform/log/common/log';
import { AccessibilitySignal, IAccessibilitySignalService } from 'vs/platform/accessibilitySignal/browser/accessibilitySignalService';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
@ -456,7 +455,7 @@ export class SearchView extends ViewPane {
// Toggle query details button
this.toggleQueryDetailsButton = dom.append(this.queryDetails,
$('.more' + ThemeIcon.asCSSSelector(searchDetailsIcon), { tabindex: 0, role: 'button' }));
this._register(setupCustomHover(getDefaultHoverDelegate('element'), this.toggleQueryDetailsButton, nls.localize('moreSearch', "Toggle Search Details")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('element'), this.toggleQueryDetailsButton, nls.localize('moreSearch', "Toggle Search Details")));
this._register(dom.addDisposableListener(this.toggleQueryDetailsButton, dom.EventType.CLICK, e => {
dom.EventHelper.stop(e);
@ -1725,20 +1724,20 @@ export class SearchView extends ViewPane {
if (!completed) {
const searchAgainButton = this.messageDisposables.add(new SearchLinkButton(
nls.localize('rerunSearch.message', "Search again"),
() => this.triggerQueryChange({ preserveFocus: false })));
() => this.triggerQueryChange({ preserveFocus: false }), this.hoverService));
dom.append(messageEl, searchAgainButton.element);
} else if (hasIncludes || hasExcludes) {
const searchAgainButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('rerunSearchInAll.message', "Search again in all files"), this.onSearchAgain.bind(this)));
const searchAgainButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('rerunSearchInAll.message', "Search again in all files"), this.onSearchAgain.bind(this), this.hoverService));
dom.append(messageEl, searchAgainButton.element);
} else {
const openSettingsButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openSettings.message', "Open Settings"), this.onOpenSettings.bind(this)));
const openSettingsButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openSettings.message', "Open Settings"), this.onOpenSettings.bind(this), this.hoverService));
dom.append(messageEl, openSettingsButton.element);
}
if (completed) {
dom.append(messageEl, $('span', undefined, ' - '));
const learnMoreButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openSettings.learnMore', "Learn More"), this.onLearnMore.bind(this)));
const learnMoreButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openSettings.learnMore', "Learn More"), this.onLearnMore.bind(this), this.hoverService));
dom.append(messageEl, learnMoreButton.element);
}
@ -1877,13 +1876,13 @@ export class SearchView extends ViewPane {
if (fileCount > 0) {
if (disregardExcludesAndIgnores) {
const excludesDisabledMessage = ' - ' + nls.localize('useIgnoresAndExcludesDisabled', "exclude settings and ignore files are disabled") + ' ';
const enableExcludesButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('excludes.enable', "enable"), this.onEnableExcludes.bind(this), nls.localize('useExcludesAndIgnoreFilesDescription', "Use Exclude Settings and Ignore Files")));
const enableExcludesButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('excludes.enable', "enable"), this.onEnableExcludes.bind(this), this.hoverService, nls.localize('useExcludesAndIgnoreFilesDescription', "Use Exclude Settings and Ignore Files")));
dom.append(messageEl, $('span', undefined, excludesDisabledMessage, '(', enableExcludesButton.element, ')'));
}
if (onlyOpenEditors) {
const searchingInOpenMessage = ' - ' + nls.localize('onlyOpenEditors', "searching only in open files") + ' ';
const disableOpenEditorsButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openEditors.disable', "disable"), this.onDisableSearchInOpenEditors.bind(this), nls.localize('disableOpenEditors', "Search in entire workspace")));
const disableOpenEditorsButton = this.messageDisposables.add(new SearchLinkButton(nls.localize('openEditors.disable', "disable"), this.onDisableSearchInOpenEditors.bind(this), this.hoverService, nls.localize('disableOpenEditors', "Search in entire workspace")));
dom.append(messageEl, $('span', undefined, searchingInOpenMessage, '(', disableOpenEditorsButton.element, ')'));
}
@ -1894,7 +1893,7 @@ export class SearchView extends ViewPane {
this.keybindingService.lookupKeybinding(Constants.SearchCommandIds.OpenInEditorCommandId));
const openInEditorButton = this.messageDisposables.add(new SearchLinkButton(
nls.localize('openInEditor.message', "Open in editor"),
() => this.instantiationService.invokeFunction(createEditorFromSearchResult, this.searchResult, this.searchIncludePattern.getValue(), this.searchExcludePattern.getValue(), this.searchIncludePattern.onlySearchInOpenEditors()),
() => this.instantiationService.invokeFunction(createEditorFromSearchResult, this.searchResult, this.searchIncludePattern.getValue(), this.searchExcludePattern.getValue(), this.searchIncludePattern.onlySearchInOpenEditors()), this.hoverService,
openInEditorTooltip));
dom.append(messageEl, openInEditorButton.element);
@ -1932,7 +1931,7 @@ export class SearchView extends ViewPane {
nls.localize('openFolder', "Open Folder"),
() => {
this.commandService.executeCommand(env.isMacintosh && env.isNative ? OpenFileFolderAction.ID : OpenFolderAction.ID).catch(err => errors.onUnexpectedError(err));
}));
}, this.hoverService));
dom.append(textEl, openFolderButton.element);
}
@ -2222,10 +2221,10 @@ export class SearchView extends ViewPane {
class SearchLinkButton extends Disposable {
public readonly element: HTMLElement;
constructor(label: string, handler: (e: dom.EventLike) => unknown, tooltip?: string) {
constructor(label: string, handler: (e: dom.EventLike) => unknown, hoverService: IHoverService, tooltip?: string) {
super();
this.element = $('a.pointer', { tabindex: 0 }, label);
this._register(setupCustomHover(getDefaultHoverDelegate('mouse'), this.element, tooltip));
this._register(hoverService.setupUpdatableHover(getDefaultHoverDelegate('mouse'), this.element, tooltip));
this.addEventHandlers(handler);
}

View file

@ -62,8 +62,8 @@ import { UnusualLineTerminatorsDetector } from 'vs/editor/contrib/unusualLineTer
import { defaultToggleStyles, getInputBoxStyle } from 'vs/platform/theme/browser/defaultStyles';
import { ILogService } from 'vs/platform/log/common/log';
import { SearchContext } from 'vs/workbench/contrib/search/common/constants';
import { setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { IHoverService } from 'vs/platform/hover/browser/hover';
const RESULT_LINE_REGEX = /^(\s+)(\d+)(: | )(\s*)(.*)$/;
const FILE_LINE_REGEX = /^(\S.*):$/;
@ -115,7 +115,8 @@ export class SearchEditor extends AbstractTextCodeEditor<SearchEditorViewState>
@IEditorService editorService: IEditorService,
@IConfigurationService protected configurationService: IConfigurationService,
@IFileService fileService: IFileService,
@ILogService private readonly logService: ILogService
@ILogService private readonly logService: ILogService,
@IHoverService private readonly hoverService: IHoverService
) {
super(SearchEditor.ID, group, telemetryService, instantiationService, storageService, textResourceService, themeService, editorService, editorGroupService, fileService);
this.container = DOM.$('.search-editor');
@ -165,7 +166,7 @@ export class SearchEditor extends AbstractTextCodeEditor<SearchEditorViewState>
// Toggle query details button
this.toggleQueryDetailsButton = DOM.append(this.includesExcludesContainer, DOM.$('.expand' + ThemeIcon.asCSSSelector(searchDetailsIcon), { tabindex: 0, role: 'button' }));
this._register(setupCustomHover(getDefaultHoverDelegate('element'), this.toggleQueryDetailsButton, localize('moreSearch', "Toggle Search Details")));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('element'), this.toggleQueryDetailsButton, localize('moreSearch', "Toggle Search Details")));
this._register(DOM.addDisposableListener(this.toggleQueryDetailsButton, DOM.EventType.CLICK, e => {
DOM.EventHelper.stop(e);
this.toggleIncludesExcludes();

View file

@ -6,7 +6,6 @@
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 { 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';
@ -17,6 +16,7 @@ import { isDefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IHoverService } from 'vs/platform/hover/browser/hover';
import { asCssVariableName, chartsGreen, chartsRed, chartsYellow } from 'vs/platform/theme/common/colorRegistry';
import { IExplorerFileContribution } from 'vs/workbench/contrib/files/browser/explorerFileContrib';
import { ITestingCoverageBarThresholds, TestingConfigKeys, TestingDisplayedCoveragePercent, getTestingConfiguration, observeTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
@ -74,12 +74,13 @@ export class ManagedTestCoverageBars extends Disposable {
constructor(
protected readonly options: TestCoverageBarsOptions,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IHoverService private readonly hoverService: IHoverService,
) {
super();
}
private attachHover(target: HTMLElement, factory: (coverage: CoverageBarSource) => string | IUpdatableHoverTooltipMarkdownString | undefined) {
this._register(setupCustomHover(getDefaultHoverDelegate('element'), target, () => this._coverage && factory(this._coverage)));
this._register(this.hoverService.setupUpdatableHover(getDefaultHoverDelegate('element'), target, () => this._coverage && factory(this._coverage)));
}
public setCoverageInfo(coverage: CoverageBarSource | undefined) {
@ -227,9 +228,10 @@ export class ExplorerTestCoverageBars extends ManagedTestCoverageBars implements
constructor(
options: TestCoverageBarsOptions,
@IConfigurationService configurationService: IConfigurationService,
@IHoverService hoverService: IHoverService,
@ITestCoverageService testCoverageService: ITestCoverageService,
) {
super(options, configurationService);
super(options, configurationService, hoverService);
const isEnabled = observeTestingConfiguration(configurationService, TestingConfigKeys.ShowCoverageInExplorer);