Merge pull request #6214 from eed3si9n/wip/completions

Fix tab completion perf regression
This commit is contained in:
eugene yokota 2020-12-19 07:49:57 -05:00 committed by GitHub
commit 26460f1c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -63,14 +63,11 @@ object LineReader {
* `testOnly testOnly\ com.foo.FooSpec` instead of `testOnly com.foo.FooSpec`.
*/
if (c.append.nonEmpty) {
val comp =
if (!pl.line().endsWith(" ")) pl.line().split(" ").last + c.append else c.append
// tell jline to append a " " if the completion would be valid with a " " appended
// which can be the case for input tasks and some commands. We need to exclude
// the empty string and ";" which always seem to be present.
val complete = (Parser.completions(parser, comp + " ", 10).get.map(_.display) --
Set(";", "")).nonEmpty
candidates.add(new Candidate(comp, comp, null, null, null, null, complete))
if (!pl.line().endsWith(" ")) {
candidates.add(new Candidate(pl.line().split(" ").last + c.append))
} else {
candidates.add(new Candidate(c.append))
}
}
}
}