Skip to content

Commit

Permalink
Match Current Context with one of Contexts
Browse files Browse the repository at this point in the history
Match current context id with one of the elements of the
Contexts array.

Signed-off-by: Thor Thayer <[email protected]>
  • Loading branch information
WyoTwT committed May 1, 2024
1 parent 82ea4da commit 25a5bda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/plugin/adapter-registry/amalgamator-gdb-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export class AmalgamatorGdbVariableTransformer extends AdapterVariableTracker {
}

async getCurrentContext(_session: vscode.DebugSession): Promise<Context | undefined> {
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<ReadMemoryResult> {
Expand Down
3 changes: 2 additions & 1 deletion src/plugin/memory-webview-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ export class MemoryWebview implements vscode.CustomReadonlyEditorProvider {
}

protected async setSessionContext(webviewParticipant: WebviewIdMessageParticipant, context: SessionContext): Promise<void> {
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 {
Expand Down

0 comments on commit 25a5bda

Please sign in to comment.