Search in sources :

Example 1 with XRegularValuePresentation

use of com.intellij.xdebugger.frame.presentation.XRegularValuePresentation 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);
}
Also used : XValuePresentation(com.intellij.xdebugger.frame.presentation.XValuePresentation) XNumericValuePresentation(com.intellij.xdebugger.frame.presentation.XNumericValuePresentation) XStringValuePresentation(com.intellij.xdebugger.frame.presentation.XStringValuePresentation) NotNull(org.jetbrains.annotations.NotNull) XRegularValuePresentation(com.intellij.xdebugger.frame.presentation.XRegularValuePresentation) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

XNumericValuePresentation (com.intellij.xdebugger.frame.presentation.XNumericValuePresentation)1 XRegularValuePresentation (com.intellij.xdebugger.frame.presentation.XRegularValuePresentation)1 XStringValuePresentation (com.intellij.xdebugger.frame.presentation.XStringValuePresentation)1 XValuePresentation (com.intellij.xdebugger.frame.presentation.XValuePresentation)1 NotNull (org.jetbrains.annotations.NotNull)1