Merge pull request #6216 from eed3si9n/bport/6214

[1.4.x] Fix tab completion perf regression
This commit is contained in:
eugene yokota 2020-12-19 15:59:26 -05:00 committed by GitHub
commit 23fee96b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -6,6 +6,7 @@ on:
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
@ -37,19 +38,19 @@ jobs:
uses: actions/checkout@v2
with:
repository: sbt/io
ref: develop
ref: 1.4.x
path: io
- name: Checkout sbt/librarymanagement
uses: actions/checkout@v2
with:
repository: sbt/librarymanagement
ref: develop
ref: 1.4.x
path: librarymanagement
- name: Checkout sbt/zinc
uses: actions/checkout@v2
with:
repository: sbt/zinc
ref: develop
ref: 1.4.x
path: zinc
- name: Setup
uses: olafurpg/setup-scala@v10

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))
}
}
}
}