debug: use badges
This commit is contained in:
parent
c3d1b9fa89
commit
9993de279d
4 changed files with 80 additions and 2 deletions
|
@ -12,7 +12,7 @@ import {DelayedDragHandler} from 'vs/base/browser/dnd';
|
|||
import {Action} from 'vs/base/common/actions';
|
||||
import {BaseActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import {IEmitterEvent} from 'vs/base/common/eventEmitter';
|
||||
import {ProgressBadge, TextBadge, NumberBadge, IBadge} from 'vs/workbench/services/activity/common/activityService';
|
||||
import {ProgressBadge, TextBadge, NumberBadge, IconBadge, IBadge} from 'vs/workbench/services/activity/common/activityService';
|
||||
|
||||
export class ActivityAction extends Action {
|
||||
|
||||
|
@ -144,6 +144,11 @@ export class ActivityActionItem extends BaseActionItem {
|
|||
this.$badge.show();
|
||||
}
|
||||
|
||||
// Text
|
||||
else if (badge instanceof IconBadge) {
|
||||
this.$badge.show();
|
||||
}
|
||||
|
||||
// Progress
|
||||
else if (badge instanceof ProgressBadge) {
|
||||
this.$badge.show();
|
||||
|
|
|
@ -9,6 +9,30 @@
|
|||
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5pY29uLWNhbnZhcy10cmFuc3BhcmVudHtvcGFjaXR5OjA7ZmlsbDojRjZGNkY2O30gLmljb24td2hpdGV7ZmlsbDojRkZGRkZGO308L3N0eWxlPjxwYXRoIGNsYXNzPSJpY29uLWNhbnZhcy10cmFuc3BhcmVudCIgZD0iTTMyIDMySDBWMGgzMnYzMnoiIGlkPSJjYW52YXMiLz48ZyBpZD0iaWNvbkJnIj48cGF0aCBjbGFzcz0iaWNvbi13aGl0ZSIgZD0iTTE3IDE5LjQ4OHY0LjI0OGMwIC40NjIuMDkgMS4yNjQtLjM3MyAxLjI2NEgxNXYtMWgxdi0zLjE5bC0uMTczLS4xOGMtMS40NTMgMS4yMDUtMy41MjggMS4yNDgtNC42Ny4xMDhDMTAgMTkuNTc4IDEwLjExOCAxOCAxMS4zNzYgMTZIOHYxSDd2LTEuNjI3QzcgMTQuOTEgNy44MDIgMTUgOC4yNjQgMTVoNC4xMDVMMTcgMTkuNDg4ek0xNCA5aC0xVjhoMS45NTVjLjQ2IDAgMS4wNDUuMjIgMS4wNDUuNjgydjMuMzQ1bC43MzYuODc1Yy4xOC0uOTczLjg5LTEuNzEgMS45MTQtMS43MS4xNDMgMCAuMzUuMDE0LjM1LjA0VjloMXYyLjYxOGMwIC4xMTcuMjY1LjM4Mi4zODIuMzgySDIzdjFoLTIuMjMzYy4wMjcgMCAuMDQyLjE1NC4wNDIuMjk4IDAgMS4wMjUtLjc0IDEuNzUzLTEuNzEyIDEuOTMybC44NzUuNzdIMjMuMzE4Yy40NjIgMCAuNjgyLjU4My42ODIgMS4wNDVWMTloLTF2LTFoLTIuNTJMMTQgMTEuNjk4Vjl6TTE2IDRDOS4zNzMgNCA0IDkuMzczIDQgMTZzNS4zNzMgMTIgMTIgMTIgMTItNS4zNzMgMTItMTJTMjIuNjI3IDQgMTYgNHptMTAgMTJjMCAyLjM5Ny0uODUgNC42LTIuMjYyIDYuMzI0TDkuNjc2IDguMjYyQzExLjQgNi44NSAxMy42MDIgNiAxNiA2YzUuNTE0IDAgMTAgNC40ODYgMTAgMTB6TTYgMTZjMC0yLjM5OC44NS00LjYgMi4yNjItNi4zMjRMMjIuMzI0IDIzLjc0QzIwLjYgMjUuMTUgMTguMzk3IDI2IDE2IDI2Yy01LjUxNCAwLTEwLTQuNDg2LTEwLTEweiIvPjwvZz48L3N2Zz4=');
|
||||
}
|
||||
|
||||
.debug-viewlet-paused-label > .badge-content {
|
||||
background-color: #007ACC;
|
||||
}
|
||||
|
||||
.debug-viewlet-paused-label > .badge-content:before {
|
||||
border: 3px solid white;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
width: 2px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.debug-viewlet-running-label > .badge-content {
|
||||
background-color: #007ACC;
|
||||
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMiAyIDE0IDE0IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDIgMiAxNCAxNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTkgMTZjLTMuODYgMC03LTMuMTQtNy03czMuMTQtNyA3LTdjMy44NTkgMCA3IDMuMTQxIDcgN3MtMy4xNDEgNy03IDd6bTAtMTIuNmMtMy4wODggMC01LjYgMi41MTMtNS42IDUuNnMyLjUxMiA1LjYgNS42IDUuNiA1LjYtMi41MTIgNS42LTUuNi0yLjUxMi01LjYtNS42LTUuNnptMy44NiA3LjFsLTMuMTYtMS44OTZ2LTMuODA0aC0xLjR2NC41OTZsMy44NCAyLjMwNS43Mi0xLjIwMXoiLz48L3N2Zz4=");
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.monaco-editor .debug-top-stack-frame-line {
|
||||
background: rgba(255, 255, 0, 0.35);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
import 'vs/css!../browser/media/debug.contribution';
|
||||
import 'vs/css!../browser/media/debugHover';
|
||||
import nls = require('vs/nls');
|
||||
import { CommonEditorRegistry, ContextKey, EditorActionDescriptor } from 'vs/editor/common/editorCommonExtensions';
|
||||
import lifecycle = require('vs/base/common/lifecycle');
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { CommonEditorRegistry, ContextKey, EditorActionDescriptor } from 'vs/editor/common/editorCommonExtensions';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import platform = require('vs/platform/platform');
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
@ -25,6 +26,7 @@ import debugwidget = require('vs/workbench/parts/debug/browser/debugActionsWidge
|
|||
import service = require('vs/workbench/parts/debug/electron-browser/debugService');
|
||||
import { DebugEditorContribution } from 'vs/workbench/parts/debug/browser/debugEditorContribution';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
|
||||
import { IActivityService, IconBadge, NumberBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activityService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
import IDebugService = debug.IDebugService;
|
||||
|
@ -43,6 +45,41 @@ class OpenDebugViewletAction extends viewlet.ToggleViewletAction {
|
|||
}
|
||||
}
|
||||
|
||||
class StatusUpdater implements wbext.IWorkbenchContribution {
|
||||
static ID = 'Monaco.IDE.UI.Viewlets.DebugViewlet.Workbench.StatusUpdater';
|
||||
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private pausedBadge: ProgressBadge;
|
||||
private runningBadge: IconBadge;
|
||||
|
||||
constructor(
|
||||
@IActivityService private activityService: IActivityService,
|
||||
@IDebugService private debugService: IDebugService
|
||||
) {
|
||||
this.pausedBadge = new IconBadge(() => { return nls.localize('debugPaused', "Paused"); });
|
||||
this.runningBadge = new ProgressBadge(() => { return nls.localize('debugRunning', "Running"); });
|
||||
this.toDispose = [this.debugService.addListener2(debug.ServiceEvents.STATE_CHANGED, () => this.onDebugServiceStateChange())];
|
||||
}
|
||||
|
||||
private onDebugServiceStateChange(): void {
|
||||
if (this.debugService.getState() === debug.State.Stopped) {
|
||||
this.activityService.showActivity(debug.VIEWLET_ID, this.pausedBadge, 'debug-viewlet-paused-label');
|
||||
} else if (this.debugService.getState() === debug.State.Running) {
|
||||
this.activityService.showActivity(debug.VIEWLET_ID, this.runningBadge, 'debug-viewlet-running-label');
|
||||
} else {
|
||||
this.activityService.clearActivity(debug.VIEWLET_ID);
|
||||
}
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
return StatusUpdater.ID;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this.toDispose = lifecycle.disposeAll(this.toDispose);
|
||||
}
|
||||
}
|
||||
|
||||
EditorBrowserRegistry.registerEditorContribution(DebugEditorContribution);
|
||||
CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(dbgactions.ToggleBreakpointAction, dbgactions.ToggleBreakpointAction.ID, nls.localize('toggleBreakpointAction', "Debug: Toggle Breakpoint"), {
|
||||
context: ContextKey.EditorTextFocus,
|
||||
|
@ -100,3 +137,8 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.AddFunction
|
|||
|
||||
// register service
|
||||
registerSingleton(IDebugService, service.DebugService);
|
||||
|
||||
// Register StatusUpdater
|
||||
(<wbext.IWorkbenchContributionsRegistry>platform.Registry.as(wbext.Extensions.Workbench)).registerWorkbenchContribution(
|
||||
StatusUpdater
|
||||
);
|
||||
|
|
|
@ -46,6 +46,13 @@ export class TextBadge extends BaseBadge {
|
|||
}
|
||||
}
|
||||
|
||||
export class IconBadge extends BaseBadge {
|
||||
|
||||
constructor(descriptorFn: (args: any) => string) {
|
||||
super(descriptorFn);
|
||||
}
|
||||
}
|
||||
|
||||
export class ProgressBadge extends BaseBadge {
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue