Uses InlineValuesProvider to get frame id

This commit is contained in:
Henning Dieterichs
2023-11-19 13:07:13 +01:00
parent 1d70b99f19
commit b66c30b610
5 changed files with 37 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
import { Disposable } from "@hediet/std/disposable";
import { debug, DebugSession } from "vscode";
import { CancellationToken, debug, DebugSession, InlineValue, InlineValueContext, InlineValuesProvider, languages, ProviderResult, Range, TextDocument } from "vscode";
import { observable, action } from "mobx";
import { DebuggerProxy } from "./DebuggerProxy";
import { DebugSessionProxy } from "./DebugSessionProxy";
@@ -30,6 +30,8 @@ export class DebuggerViewProxy {
})
);
this.updateActiveDebugSession(debug.activeDebugSession);
this.dispose.track(languages.registerInlineValuesProvider('*', new FrameIdGetter(this)));
}
@action
@@ -39,3 +41,18 @@ export class DebuggerViewProxy {
: undefined;
}
}
export class FrameIdGetter implements InlineValuesProvider {
constructor(
private readonly debuggerViewProxy: DebuggerViewProxy,
) {
}
provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]> {
const a = this.debuggerViewProxy.activeDebugSession;
if (a) {
a['_activeStackFrameId'] = context.frameId;
}
return []
}
}