Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9023

In Groovy console, add a script binding allowing values to associate to code lines

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.0.0-alpha-4
    • None
    • Groovy Console
    • None

    Description

      1. Add internal method to groovy console for determining line of code in script from method call (I've got a way to do this but perhaps someone could find a better way):
        try {throw new Exception()}
        catch (Exception e) { StackTraceUtils.sanitize(e) return e.stackTrace[0] }

      2. Add script binding (named _c maybe) to script which has a method or methods that add a value to a list associated with current code line and variable name (propertyMissing?).

      Allowing following syntax:

      x = 1
      for (i in 1..10) _c.x = x++
      x

      3. Output the values from _c into console's output. For example, following above:

      x = 1

      x = 2 3 4 5 6 7 8 9 10 11

      x = 11
      4. Output lines up with code line that produced it (or at least near it).

      5. Also, once _c is used, the font-sizes (and scrollbars?) for the code and output need to be synchronized (so they line up)

      Attachments

        Activity

          People

            Unassigned Unassigned
            adamldavis Adam L. Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: