mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
testing: add clear test button to peek view title
This commit is contained in:
parent
57af60a7b7
commit
2521499104
|
@ -128,6 +128,7 @@ export class MenuId {
|
|||
static readonly StatusBarRemoteIndicatorMenu = new MenuId('StatusBarRemoteIndicatorMenu');
|
||||
static readonly TestItem = new MenuId('TestItem');
|
||||
static readonly TestPeekElement = new MenuId('TestPeekElement');
|
||||
static readonly TestPeekTitle = new MenuId('TestPeekTitle');
|
||||
static readonly TouchBarContext = new MenuId('TouchBarContext');
|
||||
static readonly TitleBarContext = new MenuId('TitleBarContext');
|
||||
static readonly TunnelContext = new MenuId('TunnelContext');
|
||||
|
|
|
@ -579,7 +579,11 @@ export class ClearTestResultsAction extends Action2 {
|
|||
id: ClearTestResultsAction.ID,
|
||||
title: localize('testing.clearResults', "Clear All Results"),
|
||||
category,
|
||||
f1: true
|
||||
f1: true,
|
||||
icon: Codicon.trash,
|
||||
menu: {
|
||||
id: MenuId.TestPeekTitle,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
|
|||
super();
|
||||
this.visible = TestingContextKeys.isPeekVisible.bindTo(contextKeyService);
|
||||
this._register(editor.onDidChangeModel(() => this.peek.clear()));
|
||||
this._register(testResults.onResultsChanged(this.closePeekOnRunStart, this));
|
||||
this._register(testResults.onResultsChanged(this.closePeekOnCertainResultEvents, this));
|
||||
this._register(testResults.onTestChanged(this.closePeekOnTestChange, this));
|
||||
}
|
||||
|
||||
|
@ -312,9 +312,13 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
|
|||
this.removeIfPeekingForTest(evt.item.item.extId);
|
||||
}
|
||||
|
||||
private closePeekOnRunStart(evt: ResultChangeEvent) {
|
||||
private closePeekOnCertainResultEvents(evt: ResultChangeEvent) {
|
||||
if ('started' in evt) {
|
||||
this.peek.clear();
|
||||
this.peek.clear(); // close peek when runs start
|
||||
}
|
||||
|
||||
if ('removed' in evt && this.testResults.results.length === 0) {
|
||||
this.peek.clear(); // close the peek if results are cleared
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +351,8 @@ class TestingOutputPeek extends PeekViewWidget {
|
|||
editor: ICodeEditor,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IPeekViewService peekViewService: IPeekViewService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ITextModelService protected readonly modelService: ITextModelService,
|
||||
) {
|
||||
|
@ -371,6 +376,16 @@ class TestingOutputPeek extends PeekViewWidget {
|
|||
});
|
||||
}
|
||||
|
||||
protected override _fillHead(container: HTMLElement): void {
|
||||
super._fillHead(container);
|
||||
|
||||
const actions: IAction[] = [];
|
||||
const menu = this.menuService.createMenu(MenuId.TestPeekTitle, this.contextKeyService);
|
||||
createAndFillInActionBarActions(menu, undefined, actions);
|
||||
this._actionbarWidget!.push(actions, { label: false, icon: true, index: 0 });
|
||||
menu.dispose();
|
||||
}
|
||||
|
||||
protected override _fillBody(containerElement: HTMLElement): void {
|
||||
this.splitView = new SplitView(containerElement, { orientation: Orientation.HORIZONTAL });
|
||||
|
||||
|
|
Loading…
Reference in a new issue