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

@@ -0,0 +1,8 @@
function test() {
let i = 1;
debugger;
}
let i = 0;
test();

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

View File

@@ -1200,10 +1200,10 @@
dependencies:
source-map "^0.6.1"
"@types/vscode@^1.79.1":
version "1.81.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.81.0.tgz#c27228dd063002e0e00611be70b0497beaa24d39"
integrity sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==
"@types/vscode@^1.84.0":
version "1.84.1"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.84.1.tgz#2e89dc074743737209f1769f7e7762499edaca71"
integrity sha512-DB10vBRLEPA/us7p3gQilU2Tq5HDu6JWTyCpD9qtb7MKWIvJS5In9HU3YgVGCXf/miwHJiY62aXwjtUSMpT8HA==
"@types/webpack-sources@*":
version "3.2.0"