parent
2a9a512ee4
commit
489672365e
4 changed files with 36 additions and 4 deletions
|
@ -61,7 +61,12 @@ const apiMenus: IAPIMenu[] = [
|
||||||
{
|
{
|
||||||
key: 'debug/callstack/context',
|
key: 'debug/callstack/context',
|
||||||
id: MenuId.DebugCallStackContext,
|
id: MenuId.DebugCallStackContext,
|
||||||
description: localize('menus.debugCallstackContext', "The debug callstack context menu")
|
description: localize('menus.debugCallstackContext', "The debug callstack view context menu")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'debug/variables/context',
|
||||||
|
id: MenuId.DebugVariablesContext,
|
||||||
|
description: localize('menus.debugVariablesContext', "The debug variables view context menu")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'debug/toolBar',
|
key: 'debug/toolBar',
|
||||||
|
|
|
@ -21,7 +21,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
import { registerThemingParticipant, IThemeService, Themable } from 'vs/platform/theme/common/themeService';
|
import { registerThemingParticipant, IThemeService, Themable } from 'vs/platform/theme/common/themeService';
|
||||||
import { registerColor, contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
|
import { registerColor, contrastBorder, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
@ -58,7 +57,6 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
|
||||||
@IThemeService themeService: IThemeService,
|
@IThemeService themeService: IThemeService,
|
||||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||||
@IMenuService menuService: IMenuService,
|
@IMenuService menuService: IMenuService,
|
||||||
@IContextMenuService contextMenuService: IContextMenuService,
|
|
||||||
@IContextKeyService contextKeyService: IContextKeyService
|
@IContextKeyService contextKeyService: IContextKeyService
|
||||||
) {
|
) {
|
||||||
super(themeService);
|
super(themeService);
|
||||||
|
|
|
@ -34,6 +34,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
import { withUndefinedAsNull } from 'vs/base/common/types';
|
import { withUndefinedAsNull } from 'vs/base/common/types';
|
||||||
|
import { IMenuService, IMenu, MenuId } from 'vs/platform/actions/common/actions';
|
||||||
|
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||||
|
|
||||||
const $ = dom.$;
|
const $ = dom.$;
|
||||||
let forgetScopes = true;
|
let forgetScopes = true;
|
||||||
|
@ -47,6 +49,7 @@ export class VariablesView extends ViewPane {
|
||||||
private tree!: WorkbenchAsyncDataTree<IStackFrame | null, IExpression | IScope, FuzzyScore>;
|
private tree!: WorkbenchAsyncDataTree<IStackFrame | null, IExpression | IScope, FuzzyScore>;
|
||||||
private savedViewState = new Map<string, IAsyncDataTreeViewState>();
|
private savedViewState = new Map<string, IAsyncDataTreeViewState>();
|
||||||
private autoExpandedScopes = new Set<string>();
|
private autoExpandedScopes = new Set<string>();
|
||||||
|
private menu: IMenu;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
options: IViewletViewOptions,
|
options: IViewletViewOptions,
|
||||||
|
@ -61,9 +64,13 @@ export class VariablesView extends ViewPane {
|
||||||
@IOpenerService openerService: IOpenerService,
|
@IOpenerService openerService: IOpenerService,
|
||||||
@IThemeService themeService: IThemeService,
|
@IThemeService themeService: IThemeService,
|
||||||
@ITelemetryService telemetryService: ITelemetryService,
|
@ITelemetryService telemetryService: ITelemetryService,
|
||||||
|
@IMenuService menuService: IMenuService
|
||||||
) {
|
) {
|
||||||
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||||
|
|
||||||
|
this.menu = menuService.createMenu(MenuId.DebugVariablesContext, contextKeyService);
|
||||||
|
this._register(this.menu);
|
||||||
|
|
||||||
// Use scheduler to prevent unnecessary flashing
|
// Use scheduler to prevent unnecessary flashing
|
||||||
this.onFocusStackFrameScheduler = new RunOnceScheduler(async () => {
|
this.onFocusStackFrameScheduler = new RunOnceScheduler(async () => {
|
||||||
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
|
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
|
||||||
|
@ -213,11 +220,17 @@ export class VariablesView extends ViewPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const context = {
|
||||||
|
container: (variable.parent as (Variable | Scope)).toDebugProtocolObject(),
|
||||||
|
variable: variable.toDebugProtocolObject()
|
||||||
|
};
|
||||||
|
const actionsDisposable = createAndFillInContextMenuActions(this.menu, { arg: context, shouldForwardArgs: false }, actions, this.contextMenuService);
|
||||||
|
|
||||||
this.contextMenuService.showContextMenu({
|
this.contextMenuService.showContextMenu({
|
||||||
getAnchor: () => e.anchor,
|
getAnchor: () => e.anchor,
|
||||||
getActions: () => actions,
|
getActions: () => actions,
|
||||||
getActionsContext: () => variable,
|
getActionsContext: () => variable,
|
||||||
onHide: () => dispose(actions)
|
onHide: () => dispose(actionsDisposable)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,14 @@ export class Variable extends ExpressionContainer implements IExpression {
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return `${this.name}: ${this.value}`;
|
return `${this.name}: ${this.value}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toDebugProtocolObject(): DebugProtocol.Variable {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
variablesReference: this.reference || 0,
|
||||||
|
value: this.value
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Scope extends ExpressionContainer implements IScope {
|
export class Scope extends ExpressionContainer implements IScope {
|
||||||
|
@ -267,6 +275,14 @@ export class Scope extends ExpressionContainer implements IScope {
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toDebugProtocolObject(): DebugProtocol.Scope {
|
||||||
|
return {
|
||||||
|
name: this.name,
|
||||||
|
variablesReference: this.reference || 0,
|
||||||
|
expensive: this.expensive
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorScope extends Scope {
|
export class ErrorScope extends Scope {
|
||||||
|
|
Loading…
Reference in a new issue