diff --git a/packages/debug/src/browser/console/debug-console-items.tsx b/packages/debug/src/browser/console/debug-console-items.tsx index c920e4a27fab6..afc5032b32a85 100644 --- a/packages/debug/src/browser/console/debug-console-items.tsx +++ b/packages/debug/src/browser/console/debug-console-items.tsx @@ -161,6 +161,10 @@ export class DebugVariable extends ExpressionContainer { return this._value || this.variable.value; } + get readOnly(): boolean { + return this.variable.presentationHint?.attributes?.includes('readOnly') ?? false; + } + override render(): React.ReactNode { const { type, value, name } = this; return
@@ -234,7 +238,7 @@ export class DebugVariable extends ExpressionContainer { protected setNameRef = (nameRef: HTMLSpanElement | null) => this.nameRef = nameRef || undefined; async open(): Promise { - if (!this.supportSetVariable) { + if (!this.supportSetVariable || this.readOnly) { return; } const input = new SingleTextInputDialog({ diff --git a/packages/debug/src/browser/debug-frontend-application-contribution.ts b/packages/debug/src/browser/debug-frontend-application-contribution.ts index 51401d39a53ec..62a58db074a0e 100644 --- a/packages/debug/src/browser/debug-frontend-application-contribution.ts +++ b/packages/debug/src/browser/debug-frontend-application-contribution.ts @@ -856,7 +856,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi registry.registerCommand(DebugCommands.SET_VARIABLE_VALUE, { execute: () => this.selectedVariable && this.selectedVariable.open(), - isEnabled: () => !!this.selectedVariable && this.selectedVariable.supportSetVariable, + isEnabled: () => !!this.selectedVariable && this.selectedVariable.supportSetVariable && !this.selectedVariable.readOnly, isVisible: () => !!this.selectedVariable && this.selectedVariable.supportSetVariable }); registry.registerCommand(DebugCommands.COPY_VARIABLE_VALUE, {