use of com.intellij.xdebugger.frame.presentation.XStringValuePresentation in project go-lang-idea-plugin by go-lang-plugin-org.
the class DlvXValue method getPresentation.
@NotNull
private XValuePresentation getPresentation() {
String value = myVariable.value;
if (myVariable.isNumber())
return new XNumericValuePresentation(value);
if (myVariable.isString())
return new XStringValuePresentation(value);
if (myVariable.isBool()) {
return new XValuePresentation() {
@Override
public void renderValue(@NotNull XValueTextRenderer renderer) {
renderer.renderValue(value);
}
};
}
String type = myVariable.type;
boolean isSlice = myVariable.isSlice();
boolean isArray = myVariable.isArray();
if (isSlice || isArray) {
return new XRegularValuePresentation("len:" + myVariable.len + (isSlice ? ", cap:" + myVariable.cap : ""), type.replaceFirst("struct ", ""));
}
String prefix = myVariable.type + " ";
return new XRegularValuePresentation(StringUtil.startsWith(value, prefix) ? value.replaceFirst(Pattern.quote(prefix), "") : value, type);
}
use of com.intellij.xdebugger.frame.presentation.XStringValuePresentation in project intellij-plugins by JetBrains.
the class DartVmServiceValue method computeRegExpPresentation.
private boolean computeRegExpPresentation(@NotNull final XValueNode node) {
if (myInstanceRef.getKind() == InstanceKind.RegExp) {
// The pattern is always an instance of kind String.
final InstanceRef pattern = myInstanceRef.getPattern();
assert pattern.getKind() == InstanceKind.String : pattern;
final String patternString = StringUtil.replace(pattern.getValueAsString(), "\"", "\\\"");
node.setPresentation(getIcon(), new XStringValuePresentation(patternString) {
@Nullable
@Override
public String getType() {
return myInstanceRef.getClassRef().getName();
}
}, true);
if (pattern.getValueAsStringIsTruncated()) {
addFullStringValueEvaluator(node, pattern);
}
return true;
}
return false;
}
use of com.intellij.xdebugger.frame.presentation.XStringValuePresentation in project intellij-plugins by JetBrains.
the class DartVmServiceValue method computeVarHavingStringValuePresentation.
private boolean computeVarHavingStringValuePresentation(@NotNull final XValueNode node) {
// getValueAsString() is provided for the instance kinds: Null, Bool, Double, Int, String (value may be truncated), Float32x4, Float64x2, Int32x4, StackTrace
switch(myInstanceRef.getKind()) {
case Null:
case Bool:
node.setPresentation(getIcon(), new XKeywordValuePresentation(myInstanceRef.getValueAsString()), false);
break;
case Double:
case Int:
node.setPresentation(getIcon(), new XNumericValuePresentation(myInstanceRef.getValueAsString()), false);
break;
case String:
final String presentableValue = StringUtil.replace(myInstanceRef.getValueAsString(), "\"", "\\\"");
node.setPresentation(getIcon(), new XStringValuePresentation(presentableValue), false);
if (myInstanceRef.getValueAsStringIsTruncated()) {
addFullStringValueEvaluator(node, myInstanceRef);
}
break;
case Float32x4:
case Float64x2:
case Int32x4:
case StackTrace:
node.setFullValueEvaluator(new ImmediateFullValueEvaluator("Click to see stack trace...", myInstanceRef.getValueAsString()));
node.setPresentation(getIcon(), myInstanceRef.getClassRef().getName(), "", true);
break;
default:
return false;
}
return true;
}
Aggregations