mirror of https://github.com/sbt/sbt.git
Merge pull request #5719 from eatkins/jline3-completions
Set complete flag in completions
This commit is contained in:
commit
48f086059f
|
|
@ -57,11 +57,14 @@ object LineReader {
|
|||
* `testOnly testOnly\ com.foo.FooSpec` instead of `testOnly com.foo.FooSpec`.
|
||||
*/
|
||||
if (c.append.nonEmpty) {
|
||||
if (!pl.line().endsWith(" ")) {
|
||||
candidates.add(new Candidate(pl.line().split(" ").last + c.append))
|
||||
} else {
|
||||
candidates.add(new Candidate(c.append))
|
||||
}
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package sbt.internal.util
|
||||
|
||||
import java.io.{ InputStream, InterruptedIOException, OutputStream, PrintStream }
|
||||
import java.io.{ InputStream, InterruptedIOException, IOException, OutputStream, PrintStream }
|
||||
import java.nio.channels.ClosedChannelException
|
||||
import java.util.{ Arrays, Locale }
|
||||
import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
||||
|
|
@ -171,7 +171,8 @@ object Terminal {
|
|||
if (System.getProperty("sbt.jline.verbose", "false") != "true")
|
||||
jline.internal.Log.setOutput(new PrintStream(_ => {}, false))
|
||||
def consoleLog(string: String): Unit = {
|
||||
Terminal.console.printStream.println(s"[info] $string")
|
||||
try Terminal.console.printStream.println(s"[info] $string")
|
||||
catch { case _: IOException => }
|
||||
}
|
||||
private[sbt] def set(terminal: Terminal) = {
|
||||
activeTerminal.set(terminal)
|
||||
|
|
|
|||
Loading…
Reference in New Issue