Show local type in exception hover tooltips (#1397)
This commit is contained in:
1 parent
80a5342776
commit
83b0fb1f4d
1 file changed
+4
-2
@@ -1059,13 +1059,15 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
continue;
|
continue;
|
||||||
stringsToFormat.add(format + line.substring(lastPos, foundLocal.getKey()));
|
stringsToFormat.add(format + line.substring(lastPos, foundLocal.getKey()));
|
||||||
stringsToFormat.add(format + foundLocal.getValue());
|
stringsToFormat.add(format + foundLocal.getValue());
|
||||||
|
Value val = context.variables.get(foundLocal.getValue()).evalValue(context);
|
||||||
|
String type = val.getTypeString();
|
||||||
String value;
|
String value;
|
||||||
try {
|
try {
|
||||||
value = context.variables.get(foundLocal.getValue()).evalValue(context).getPrettyString();
|
value = val.getPrettyString();
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError e) {
|
||||||
value = "Exception while rendering variable, there seems to be a recursive reference in there";
|
value = "Exception while rendering variable, there seems to be a recursive reference in there";
|
||||||
}
|
}
|
||||||
stringsToFormat.add("^ Value of '" + foundLocal.getValue() + "' at position: \n"
|
stringsToFormat.add("^ Value of '" + foundLocal.getValue() + "' at position (" + type + "): \n"
|
||||||
+ value);
|
+ value);
|
||||||
lastPos = foundLocal.getKey() + foundLocal.getValue().length();
|
lastPos = foundLocal.getKey() + foundLocal.getValue().length();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user