Use createGraph to represent object graphs constructed from variables
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>java</name>
|
||||
<comment/>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<name>java</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1599063072264</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import {
|
||||
createGraph,
|
||||
CreateGraphEdge,
|
||||
DataExtractionResult,
|
||||
DataExtractorId,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
@@ -49,6 +51,8 @@ export class GenericEvaluator implements Evaluator {
|
||||
// Use structural information about variables
|
||||
// from the evaluation response if present.
|
||||
if (reply.variablesReference) {
|
||||
let obj = await this.constructObjectFromVariablesReference(reply.variablesReference);
|
||||
|
||||
return {
|
||||
kind: "data",
|
||||
result: {
|
||||
@@ -58,7 +62,30 @@ export class GenericEvaluator implements Evaluator {
|
||||
name: "Generic",
|
||||
priority: 1,
|
||||
},
|
||||
data: await this.constructObjectFromVariablesReference(reply.variablesReference),
|
||||
data: createGraph(
|
||||
[obj],
|
||||
(item: any) => {
|
||||
function isObject(val: any): boolean {
|
||||
return val && typeof val === "object";
|
||||
}
|
||||
|
||||
const edges = new Array<CreateGraphEdge<any>>();
|
||||
for (const [key, val] of Object.entries(item)) {
|
||||
if (isObject(val)) {
|
||||
edges.push({ label: key, to: val });
|
||||
}
|
||||
}
|
||||
|
||||
const label = `${item}`;
|
||||
|
||||
return {
|
||||
shape: "box",
|
||||
edges,
|
||||
color: item === obj ? "lightblue" : undefined,
|
||||
label,
|
||||
};
|
||||
}
|
||||
),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user