Allow separators to have tooltips & descriptions (#208224)

This allows the full-length separators to have tooltips and descriptions.

(They had support for tooltips already, but my refactoring to a tree broke that)

so really this just adds descriptions and fixes tooltips. Because of this, we now adopt the description in favor of the tooltip for QuickSearch
This commit is contained in:
Tyler James Leonhardt 2024-03-20 10:09:14 -07:00 committed by GitHub
parent abb6332a8c
commit cb9524cf4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -110,6 +110,8 @@ class BaseQuickPickItemElement implements IQuickPickElement {
saneAriaLabel
};
});
this._saneDescription = mainItem.description;
this._saneTooltip = mainItem.tooltip;
}
// #region Lazy Getters
@ -144,7 +146,7 @@ class BaseQuickPickItemElement implements IQuickPickElement {
this._hidden = value;
}
protected _saneDescription?: string;
private _saneDescription?: string;
get saneDescription() {
return this._saneDescription;
}
@ -160,7 +162,7 @@ class BaseQuickPickItemElement implements IQuickPickElement {
this._saneDetail = value;
}
protected _saneTooltip?: string | IMarkdownString | HTMLElement;
private _saneTooltip?: string | IMarkdownString | HTMLElement;
get saneTooltip() {
return this._saneTooltip;
}
@ -210,9 +212,7 @@ class QuickPickItemElement extends BaseQuickPickItemElement {
? Event.map(Event.filter<{ element: IQuickPickElement; checked: boolean }>(this._onChecked.event, e => e.element === this), e => e.checked)
: Event.None;
this._saneDescription = item.description;
this._saneDetail = item.detail;
this._saneTooltip = this.item.tooltip;
this._labelHighlights = item.highlights?.label;
this._descriptionHighlights = item.highlights?.description;
this._detailHighlights = item.highlights?.detail;

View file

@ -57,6 +57,7 @@ export interface IQuickPickSeparator {
type: 'separator';
id?: string;
label?: string;
description?: string;
ariaLabel?: string;
buttons?: readonly IQuickInputButton[];
tooltip?: string | IMarkdownString;

View file

@ -254,7 +254,7 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<ITextSearch
picks.push({
label,
type: 'separator',
tooltip: description,
description,
buttons: [{
iconClass: ThemeIcon.asClassName(searchOpenInFileIcon),
tooltip: localize('QuickSearchOpenInFile', "Open File")