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,10 @@
# Change Log
## 2.6.0
- Improved JS data extractors
- Uses the active stack frame (instead of the top-most) for evaluating expressions
## 2.4.0
- [Ruby support](https://github.com/hediet/vscode-debug-visualizer/pull/159)

View File

@@ -7,7 +7,7 @@
"version": "2.6.0",
"license": "GPL-3.0",
"engines": {
"vscode": "^1.79.1"
"vscode": "^1.84.0"
},
"publisher": "hediet",
"keywords": [
@@ -136,7 +136,7 @@
"@types/express": "^4.17.2",
"@types/serve-static": "^1.13.3",
"@types/node": "^13.7.4",
"@types/vscode": "^1.79.1",
"@types/vscode": "^1.84.0",
"tslint": "^6.1.3",
"typescript": "^5.1.6",
"webpack": "^5.88.1",

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 []
}
}