From cbd70d27c8b15f3d0bc8b0fa68866437f0f3e738 Mon Sep 17 00:00:00 2001 From: Andrey Ovsyankin Date: Thu, 2 Nov 2023 14:47:42 +0300 Subject: [PATCH 1/2] Use description field as thread stopped status. fixes #13049 If thread Stopped event contains description field, UI must show description as is --- .../debug/src/browser/model/debug-thread.tsx | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/debug/src/browser/model/debug-thread.tsx b/packages/debug/src/browser/model/debug-thread.tsx index 7c725152836c8..93c62a263dac7 100644 --- a/packages/debug/src/browser/model/debug-thread.tsx +++ b/packages/debug/src/browser/model/debug-thread.tsx @@ -229,22 +229,35 @@ export class DebugThread extends DebugThreadData implements TreeElement { } render(): React.ReactNode { - const reason = this.stoppedDetails && this.stoppedDetails.reason; - const localizedReason = this.getLocalizedReason(reason); - - const status = this.stoppedDetails - ? reason - ? nls.localizeByDefault('Paused on {0}', localizedReason) - : nls.localizeByDefault('Paused') - : nls.localizeByDefault('Running'); return (
{this.raw.name} - {status} + {this.threadStatus()}
); } + protected threadStatus(): string { + + if (!this.stoppedDetails) { + return nls.localizeByDefault('Running'); + } + + const description = this.stoppedDetails.description; + + if (description) { + // According to DAP we must show description as is. Translation is made by debug adapter + return description; + } + + const reason = this.stoppedDetails.reason; + const localizedReason = this.getLocalizedReason(reason); + + return reason + ? nls.localizeByDefault('Paused on {0}', localizedReason) + : nls.localizeByDefault('Paused'); + } + protected getLocalizedReason(reason: string | undefined): string { switch (reason) { case 'step': @@ -269,5 +282,4 @@ export class DebugThread extends DebugThreadData implements TreeElement { return ''; } } - } From d2107ed6f60247bb05f598dec42266c71dc4f1bf Mon Sep 17 00:00:00 2001 From: Andrey Ovsyankin Date: Tue, 7 Nov 2023 10:18:07 +0300 Subject: [PATCH 2/2] Lint fixes --- packages/debug/src/browser/model/debug-thread.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/debug/src/browser/model/debug-thread.tsx b/packages/debug/src/browser/model/debug-thread.tsx index 93c62a263dac7..1aae18af9d98a 100644 --- a/packages/debug/src/browser/model/debug-thread.tsx +++ b/packages/debug/src/browser/model/debug-thread.tsx @@ -238,18 +238,18 @@ export class DebugThread extends DebugThreadData implements TreeElement { } protected threadStatus(): string { - + if (!this.stoppedDetails) { return nls.localizeByDefault('Running'); } - + const description = this.stoppedDetails.description; - + if (description) { // According to DAP we must show description as is. Translation is made by debug adapter return description; } - + const reason = this.stoppedDetails.reason; const localizedReason = this.getLocalizedReason(reason);