scala / scala-dev

Scala 2 team issues. Not for user-facing bugs or directly actionable user-facing improvements. For build/test/infra and for longer-term planning and idea tracking. Our bug tracker is at https://github.com/scala/bug/issues
Apache License 2.0
130 stars 14 forks source link

REPL autocompletion hang with long identifiers #271

Closed retronym closed 8 years ago

retronym commented 8 years ago

The fuzzy matching algorithm I implemented performs poorly for candidates that are long (or mabye have many CamelCaseHumps?)

scala> (x: thisIsAReallyLongMethodNameWithManyManyManyManyChunks) => tia<TAB> // hangs

Existing test cases:

https://github.com/scala/scala/blob/2.12.x/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala

The culpable algorithm: https://github.com/scala/scala/blob/9c5d3f81a667917b6a3aed5098182623c417c137/src/interactive/scala/tools/nsc/interactive/Global.scala#L1187-L1196

retronym commented 8 years ago

The algorithm could be looked at as a 2D pathfinding algorithm:

image

som-snytt commented 8 years ago

How fortunate I am to have the upcoming American Thanksgiving holiday to learn a thing, or two.