Skip to content

Commit de3e5a4

Browse files
committed
debug: always send name to evalute with clipboard context
1 parent 7fd005a commit de3e5a4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/vs/workbench/contrib/debug/browser/debugActions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Action } from 'vs/base/common/actions';
88
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
99
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
1010
import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession, ILaunch } from 'vs/workbench/contrib/debug/common/debug';
11-
import { Variable, Breakpoint, FunctionBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
11+
import { Variable, Breakpoint, FunctionBreakpoint, Expression } from 'vs/workbench/contrib/debug/common/debugModel';
1212
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1313
import { INotificationService } from 'vs/platform/notification/common/notification';
1414
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -380,12 +380,12 @@ export class CopyValueAction extends Action {
380380
static readonly LABEL = nls.localize('copyValue', "Copy Value");
381381

382382
constructor(
383-
id: string, label: string, private value: Variable | string, private context: string,
383+
id: string, label: string, private value: Variable | Expression, private context: string,
384384
@IDebugService private readonly debugService: IDebugService,
385385
@IClipboardService private readonly clipboardService: IClipboardService
386386
) {
387-
super(id, label, 'debug-action copy-value');
388-
this._enabled = typeof this.value === 'string' || (this.value instanceof Variable && !!this.value.evaluateName);
387+
super(id, label);
388+
this._enabled = (this.value instanceof Expression) || (this.value instanceof Variable && !!this.value.evaluateName);
389389
}
390390

391391
async run(): Promise<any> {
@@ -396,7 +396,7 @@ export class CopyValueAction extends Action {
396396
}
397397

398398
const context = session.capabilities.supportsClipboardContext ? 'clipboard' : this.context;
399-
const toEvaluate = typeof this.value === 'string' ? this.value : this.value.evaluateName || this.value.value;
399+
const toEvaluate = this.value instanceof Variable ? (this.value.evaluateName || this.value.value) : this.value.name;
400400

401401
try {
402402
const evaluation = await session.evaluate(toEvaluate, stackFrame.frameId, context);

src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class WatchExpressionsView extends ViewPane {
189189
this.debugService.getViewModel().setSelectedExpression(expression);
190190
return Promise.resolve();
191191
}));
192-
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value, 'watch'));
192+
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression, 'watch'));
193193
actions.push(new Separator());
194194

195195
actions.push(new Action('debug.removeWatchExpression', nls.localize('removeWatchExpression', "Remove Expression"), undefined, true, () => {

0 commit comments

Comments
 (0)