Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] any objections to changing the "toString" of the CollectionType?


  that 'number[8]' is supposed to work like the java debugger where if you have an aray you see something like char[5] which tells you that it's a character array and it has a size of 5.

  so in this case, you have an array of numbers w/ a size of 8.

  looking at the type of the first element for a script array may not make sense b/c they can be heterogenous.

  i'd like the behavior to remain consistent w/ how the java debugger works (if possible), where the details pane shows the 'expanded' values, while the collapsed array (and/or hash) continues to show at 'somthing[size]'. i was going to work on a way to override what gets displayed in the details pane if you don't have a detail formatter setup next or the debugger engine doesn't support evaluations.

  the implemenation below would end up in a method like 'formatDetailView' or something along those lines.

On Wed, Jul 2, 2008 at 6:10 AM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Now we get something like this in the debugger:

"number[8]"

What does that say? Nobody can see whats really in it without really expanding it and so on
The Rhino debugger (the old one) did this:

"Array(10.0,200.0,30.0,40.0,5006.0,700.0,200.0,"johan")"

Of course not the complete array values limit it (currently 100 values)

This is the code:

public String formatValue(IScriptValue value) {
        StringBuffer sb = new StringBuffer();
        sb.append(value.getRawValue()); // == Array
        sb.append("("); // == Array

        try {
            IVariable[] variables2 = value.getVariables();
            if (variables2.length > 0) {
                int length = variables2.length;
                length = length > 100 ? 100 : length;
                for (int i = 0; i < variables2.length; i++) {
                    sb.append(variables2[i].getValue().getValueString());
                    sb.append(",");
                }
                sb.setLength(sb.length() - 1);
            }
        } catch (DebugException ex) {
            ex.printStackTrace();
        }
        sb.append(")"); // == Array

        addInstanceId(value, sb);

        return sb.toString();
    }

Should i commit this? Or are you guys liking the current behavior better?

johan


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
-jae

Back to the top