Skip to content

Commit b66c30b

Browse files
committed
Uses InlineValuesProvider to get frame id
1 parent 1d70b99 commit b66c30b

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

demos/js/src/demo_stack-frames.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
function test() {
3+
let i = 1;
4+
debugger;
5+
}
6+
7+
let i = 0;
8+
test();

extension/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 2.6.0
4+
5+
- Improved JS data extractors
6+
- Uses the active stack frame (instead of the top-most) for evaluating expressions
7+
38
## 2.4.0
49

510
- [Ruby support](https://github.com/hediet/vscode-debug-visualizer/pull/159)

extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": "2.6.0",
88
"license": "GPL-3.0",
99
"engines": {
10-
"vscode": "^1.79.1"
10+
"vscode": "^1.84.0"
1111
},
1212
"publisher": "hediet",
1313
"keywords": [
@@ -136,7 +136,7 @@
136136
"@types/express": "^4.17.2",
137137
"@types/serve-static": "^1.13.3",
138138
"@types/node": "^13.7.4",
139-
"@types/vscode": "^1.79.1",
139+
"@types/vscode": "^1.84.0",
140140
"tslint": "^6.1.3",
141141
"typescript": "^5.1.6",
142142
"webpack": "^5.88.1",

extension/src/proxies/DebuggerViewProxy.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Disposable } from "@hediet/std/disposable";
2-
import { debug, DebugSession } from "vscode";
2+
import { CancellationToken, debug, DebugSession, InlineValue, InlineValueContext, InlineValuesProvider, languages, ProviderResult, Range, TextDocument } from "vscode";
33
import { observable, action } from "mobx";
44
import { DebuggerProxy } from "./DebuggerProxy";
55
import { DebugSessionProxy } from "./DebugSessionProxy";
@@ -30,6 +30,8 @@ export class DebuggerViewProxy {
3030
})
3131
);
3232
this.updateActiveDebugSession(debug.activeDebugSession);
33+
34+
this.dispose.track(languages.registerInlineValuesProvider('*', new FrameIdGetter(this)));
3335
}
3436

3537
@action
@@ -39,3 +41,18 @@ export class DebuggerViewProxy {
3941
: undefined;
4042
}
4143
}
44+
45+
export class FrameIdGetter implements InlineValuesProvider {
46+
constructor(
47+
private readonly debuggerViewProxy: DebuggerViewProxy,
48+
) {
49+
}
50+
51+
provideInlineValues(document: TextDocument, viewPort: Range, context: InlineValueContext, token: CancellationToken): ProviderResult<InlineValue[]> {
52+
const a = this.debuggerViewProxy.activeDebugSession;
53+
if (a) {
54+
a['_activeStackFrameId'] = context.frameId;
55+
}
56+
return []
57+
}
58+
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,10 +1200,10 @@
12001200
dependencies:
12011201
source-map "^0.6.1"
12021202

1203-
"@types/vscode@^1.79.1":
1204-
version "1.81.0"
1205-
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.81.0.tgz#c27228dd063002e0e00611be70b0497beaa24d39"
1206-
integrity sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==
1203+
"@types/vscode@^1.84.0":
1204+
version "1.84.1"
1205+
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.84.1.tgz#2e89dc074743737209f1769f7e7762499edaca71"
1206+
integrity sha512-DB10vBRLEPA/us7p3gQilU2Tq5HDu6JWTyCpD9qtb7MKWIvJS5In9HU3YgVGCXf/miwHJiY62aXwjtUSMpT8HA==
12071207

12081208
"@types/webpack-sources@*":
12091209
version "3.2.0"

0 commit comments

Comments
 (0)