allow to mark a language status item as busy, https://github.com/microsoft/vscode/issues/129037

This commit is contained in:
Johannes Rieken 2021-11-26 11:41:50 +01:00
parent bc75bda008
commit 6b2aa3abfd
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798
4 changed files with 17 additions and 4 deletions

View file

@ -98,6 +98,7 @@ export class ExtHostLanguages implements ExtHostLanguagesShape {
command: undefined,
text: '',
detail: '',
busy: false
};
let soonHandle: IDisposable | undefined;
@ -115,7 +116,8 @@ export class ExtHostLanguages implements ExtHostLanguagesShape {
detail: data.detail ?? '',
severity: data.severity === LanguageStatusSeverity.Error ? Severity.Error : data.severity === LanguageStatusSeverity.Warning ? Severity.Warning : Severity.Info,
command: data.command && this._commands.toInternal(data.command, commandDisposables),
accessibilityInfo: data.accessibilityInformation
accessibilityInfo: data.accessibilityInformation,
busy: data.busy
});
}, 0);
};
@ -178,6 +180,13 @@ export class ExtHostLanguages implements ExtHostLanguagesShape {
set command(value) {
data.command = value;
updateAsync();
},
get busy() {
return data.busy;
},
set busy(value: boolean) {
data.busy = value;
updateAsync();
}
};
updateAsync();

View file

@ -160,18 +160,20 @@ class EditorStatusContribution implements IWorkbenchContribution {
const showSeverity = first.severity >= Severity.Warning;
const text = EditorStatusContribution._severityToComboCodicon(first.severity);
let isOneBusy = false;
const ariaLabels: string[] = [];
const element = document.createElement('div');
for (const status of model.combined) {
element.appendChild(this._renderStatus(status, showSeverity, this._renderDisposables));
ariaLabels.push(this._asAriaLabel(status));
isOneBusy = isOneBusy || status.busy;
}
const props: IStatusbarEntry = {
name: localize('langStatus.name', "Editor Language Status"),
ariaLabel: localize('langStatus.aria', "Editor Language Status: {0}", ariaLabels.join(', next: ')),
tooltip: element,
command: ShowTooltipCommand,
text,
text: isOneBusy ? `${text}\u00A0\u00A0$(sync~spin)` : text,
};
if (!this._combinedEntry) {
this._combinedEntry = this._statusBarService.addEntry(props, EditorStatusContribution._id, StatusbarAlignment.RIGHT, { id: 'status.editor.mode', alignment: StatusbarAlignment.LEFT, compact: true });
@ -219,7 +221,7 @@ class EditorStatusContribution implements IWorkbenchContribution {
const label = document.createElement('span');
label.classList.add('label');
dom.append(label, ...renderLabelWithIcons(status.label));
dom.append(label, ...renderLabelWithIcons(status.busy ? `$(sync~spin)\u00A0\u00A0${status.label}` : status.label));
left.appendChild(label);
const detail = document.createElement('span');
@ -311,7 +313,7 @@ class EditorStatusContribution implements IWorkbenchContribution {
return {
name: localize('name.pattern', '{0} (Language Status)', item.name),
text: item.label,
text: item.busy ? `${item.label}\u00A0\u00A0$(sync~spin)` : item.label,
ariaLabel: item.accessibilityInfo?.label ?? item.label,
role: item.accessibilityInfo?.role,
tooltip: item.command?.tooltip || new MarkdownString(item.detail, true),

View file

@ -23,6 +23,7 @@ export interface ILanguageStatus {
readonly severity: Severity;
readonly label: string;
readonly detail: string;
readonly busy: boolean;
readonly source: string;
readonly command: Command | undefined;
readonly accessibilityInfo: IAccessibilityInformation | undefined;

View file

@ -18,6 +18,7 @@ declare module 'vscode' {
selector: DocumentSelector;
// todo@jrieken replace with boolean ala needsAttention
severity: LanguageStatusSeverity;
busy: boolean;
name: string | undefined;
text: string;
detail?: string;