Skip to content

Commit 4aca50f

Browse files
committed
Use createGraph to represent object graphs constructed from variables
1 parent 6ef0ecb commit 4aca50f

2 files changed

Lines changed: 55 additions & 17 deletions

File tree

demos/java/.project

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>java</name>
4-
<comment/>
5-
<projects>&#xD;
6-
</projects>
7-
<buildSpec>
8-
<buildCommand>
9-
<name>org.eclipse.jdt.core.javabuilder</name>
10-
<arguments>&#xD;
11-
</arguments>
12-
</buildCommand>
13-
</buildSpec>
14-
<natures>
15-
<nature>org.eclipse.jdt.core.javanature</nature>
16-
</natures>
17-
</projectDescription>
3+
<name>java</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1599063072264</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
28+
</projectDescription>

extension/src/EvaluationWatchService/EvaluationEngine/GenericEvaluationEngine.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import {
2+
createGraph,
3+
CreateGraphEdge,
24
DataExtractionResult,
35
DataExtractorId,
46
} from "@hediet/debug-visualizer-data-extraction";
@@ -49,6 +51,8 @@ export class GenericEvaluator implements Evaluator {
4951
// Use structural information about variables
5052
// from the evaluation response if present.
5153
if (reply.variablesReference) {
54+
let obj = await this.constructObjectFromVariablesReference(reply.variablesReference);
55+
5256
return {
5357
kind: "data",
5458
result: {
@@ -58,7 +62,30 @@ export class GenericEvaluator implements Evaluator {
5862
name: "Generic",
5963
priority: 1,
6064
},
61-
data: await this.constructObjectFromVariablesReference(reply.variablesReference),
65+
data: createGraph(
66+
[obj],
67+
(item: any) => {
68+
function isObject(val: any): boolean {
69+
return val && typeof val === "object";
70+
}
71+
72+
const edges = new Array<CreateGraphEdge<any>>();
73+
for (const [key, val] of Object.entries(item)) {
74+
if (isObject(val)) {
75+
edges.push({ label: key, to: val });
76+
}
77+
}
78+
79+
const label = `${item}`;
80+
81+
return {
82+
shape: "box",
83+
edges,
84+
color: item === obj ? "lightblue" : undefined,
85+
label,
86+
};
87+
}
88+
),
6289
},
6390
}
6491
} else {

0 commit comments

Comments
 (0)