From b531f77b26490658c3cf70652510665409da9c49 Mon Sep 17 00:00:00 2001 From: WyoTwT Date: Tue, 30 Apr 2024 23:20:10 +0200 Subject: [PATCH] Match Current Context with one of Contexts Match current context id with one of the elements of the Contexts array. Signed-off-by: Thor Thayer --- src/plugin/adapter-registry/amalgamator-gdb-tracker.ts | 6 +++++- src/plugin/memory-webview-main.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugin/adapter-registry/amalgamator-gdb-tracker.ts b/src/plugin/adapter-registry/amalgamator-gdb-tracker.ts index efc31b9..9176ed1 100644 --- a/src/plugin/adapter-registry/amalgamator-gdb-tracker.ts +++ b/src/plugin/adapter-registry/amalgamator-gdb-tracker.ts @@ -90,7 +90,11 @@ export class AmalgamatorGdbVariableTransformer extends AdapterVariableTracker { } async getCurrentContext(_session: vscode.DebugSession): Promise { - return Promise.resolve(this.currentContext); + const curContext = this.contexts?.length ? + (this.contexts?.filter(context => context.id === this.currentContext?.id).shift() ?? + this.currentContext) : + this.currentContext; + return Promise.resolve(curContext); } readMemory(session: vscode.DebugSession, args: ReadMemoryArguments, context: Context): Promise { diff --git a/src/plugin/memory-webview-main.ts b/src/plugin/memory-webview-main.ts index 15f29e9..c9e2f3c 100644 --- a/src/plugin/memory-webview-main.ts +++ b/src/plugin/memory-webview-main.ts @@ -263,8 +263,9 @@ export class MemoryWebview implements vscode.CustomReadonlyEditorProvider { } protected async setSessionContext(webviewParticipant: WebviewIdMessageParticipant, context: SessionContext): Promise { + const contexts = await this.getContexts(); // Want to read this first. await this.messenger.sendRequest(sessionContextChangedType, webviewParticipant, [context, - await this.getCurrentContext(), await this.getContexts()]); + await this.getCurrentContext(), contexts]); } protected getMemoryViewSettings(messageParticipant: WebviewIdMessageParticipant, title: string): MemoryViewSettings {