From de3e5a4bf4beaf404d06d4375f6b5d3cd24c3ef8 Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 18 May 2020 11:02:43 +0200 Subject: [PATCH] debug: always send name to evalute with clipboard context --- src/vs/workbench/contrib/debug/browser/debugActions.ts | 10 +++++----- .../contrib/debug/browser/watchExpressionsView.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugActions.ts b/src/vs/workbench/contrib/debug/browser/debugActions.ts index 9aeef0effac..ad88e27d879 100644 --- a/src/vs/workbench/contrib/debug/browser/debugActions.ts +++ b/src/vs/workbench/contrib/debug/browser/debugActions.ts @@ -8,7 +8,7 @@ import { Action } from 'vs/base/common/actions'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession, ILaunch } from 'vs/workbench/contrib/debug/common/debug'; -import { Variable, Breakpoint, FunctionBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel'; +import { Variable, Breakpoint, FunctionBreakpoint, Expression } from 'vs/workbench/contrib/debug/common/debugModel'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; @@ -380,12 +380,12 @@ export class CopyValueAction extends Action { static readonly LABEL = nls.localize('copyValue', "Copy Value"); constructor( - id: string, label: string, private value: Variable | string, private context: string, + id: string, label: string, private value: Variable | Expression, private context: string, @IDebugService private readonly debugService: IDebugService, @IClipboardService private readonly clipboardService: IClipboardService ) { - super(id, label, 'debug-action copy-value'); - this._enabled = typeof this.value === 'string' || (this.value instanceof Variable && !!this.value.evaluateName); + super(id, label); + this._enabled = (this.value instanceof Expression) || (this.value instanceof Variable && !!this.value.evaluateName); } async run(): Promise { @@ -396,7 +396,7 @@ export class CopyValueAction extends Action { } const context = session.capabilities.supportsClipboardContext ? 'clipboard' : this.context; - const toEvaluate = typeof this.value === 'string' ? this.value : this.value.evaluateName || this.value.value; + const toEvaluate = this.value instanceof Variable ? (this.value.evaluateName || this.value.value) : this.value.name; try { const evaluation = await session.evaluate(toEvaluate, stackFrame.frameId, context); diff --git a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts index d0d836d82b5..e24c688f8d2 100644 --- a/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts +++ b/src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts @@ -189,7 +189,7 @@ export class WatchExpressionsView extends ViewPane { this.debugService.getViewModel().setSelectedExpression(expression); return Promise.resolve(); })); - actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value, 'watch')); + actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression, 'watch')); actions.push(new Separator()); actions.push(new Action('debug.removeWatchExpression', nls.localize('removeWatchExpression', "Remove Expression"), undefined, true, () => {