Scott Murphy Heiberg created GROOVY-12786:
---------------------------------------------

             Summary: groovysh: Tab after an unknown dotted name walks the 
whole working directory
                 Key: GROOVY-12786
                 URL: https://issues.apache.org/jira/browse/GROOVY-12786
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 6.0.0
            Reporter: Scott Murphy Heiberg


Tab completion of a dotted name whose receiver is not a known variable or 
class, such as {{foo.}}, {{[1..2].}} or {{import com.}}, freezes groovysh for 
as long as it takes to walk every file below the directory groovysh was started 
in. {{GroovyEngine.Helpers.sourcesForPackage}} looks for {{.groovy}} sources of 
the package with {{Files.walk(Paths.get("."))}} and matches each path against 
the package, so the whole tree is walked even when the name cannot be a package.

Started from a checkout with about 990,000 files, Groovy 6.0.0 takes 22 to 25 
seconds for each such Tab; from an empty directory it takes 0.2 seconds. Groovy 
6.0.0's groovysh always completes this way; on master the shell completer is 
the fallback when syntax checking is off.

Only the directory named by the complete segments of the package needs walking: 
a name with a segment that is not a Java identifier, or whose directory does 
not exist, has no sources to find.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to