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

Extend groovysh completion evaluating "mostly" safe expressions before cursor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.3
    • 2.2.0-beta-1
    • Groovysh
    • None
    • Any

    Description

      Currently, Groovysh code completion completes far less expressions than it safely could. The main blocker is that the code that determines whether and what to complete iterates over the current line character by character and completes only java identifiers.

      Suggest to use a GroovyLexer approach instead and complete any expression that does not have method invocations in the expression part before the cursor.

      This allows completion of expressions like
      "foo".
      [1, 2, 3].
      foo.bar.baz.

      And multiline expressions like

      x = [1,
      2].

      y = """start
      end""".

      Caveat: The expressions evaluated also include getters and operators, as well as expressions like
      "foo"().

      This can lead to undesired side effects and long running completion times, but this disadvantage is unlikely to occur and is outweighted by far by the advantages IMO.

      Attachments

        Issue Links

          Activity

            People

              pschumacher Pascal Schumacher
              tkruse Thibault Kruse
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: