debug: always send name to evalute with clipboard context

This commit is contained in:
isidor
2020-05-18 11:02:43 +02:00
parent 7fd005a3ff
commit de3e5a4bf4
2 changed files with 6 additions and 6 deletions
@@ -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<any> {
@@ -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);
@@ -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, () => {