From 76c4ae56f09bcdf671b298af1368ac7811c628a1 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 19 Dec 2020 00:01:16 -0500 Subject: [PATCH] Revert "Set complete flag in completions" This reverts commit edf43a473b18f5c185475aa39d227eeb94e3ea8e. This fixes performance regression of tab completion observerd in https://github.com/sbt/sbt/issues/6204 --- .../main/scala/sbt/internal/util/LineReader.scala | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala b/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala index ef1a345b2..8f04bd5cb 100644 --- a/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala +++ b/internal/util-complete/src/main/scala/sbt/internal/util/LineReader.scala @@ -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)) + } } } }