From 70cf4175253b171dffb833670dc276477e07a9ff Mon Sep 17 00:00:00 2001 From: jvican Date: Mon, 1 May 2017 23:31:47 +0200 Subject: [PATCH] Fix #3161: Don't fail if group is not present This covers the case described in #1361 plus an esoteric case too. Parsers are initialized when sbt starts and text completions use the knowledge at that time. If we happen to move a new file that should influence the behaviour of the tab completion, that file will not be picked up. Before, since we were throwing an error, the previous case that would no produce any tab completion would also fail, though the files are legitimately in the correct place. --- project/Scripted.scala | 2 +- scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project/Scripted.scala b/project/Scripted.scala index 621db9af5..96473f4a9 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -70,7 +70,7 @@ object Scripted { else dropped.take(pageSize) } def nameP(group: String) = { - token("*".id | id.examples(pairMap(group))) + token("*".id | id.examples(pairMap.getOrElse(group, Set.empty[String]))) } val PagedIds: Parser[Seq[String]] = for { diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala index 62cd0c6d9..7aa4edcc0 100644 --- a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala +++ b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala @@ -99,7 +99,7 @@ object ScriptedPlugin extends AutoPlugin { else dropped.take(pageSize) } def nameP(group: String) = { - token("*".id | id.examples(pairMap(group))) + token("*".id | id.examples(pairMap.getOrElse(group, Set.empty[String]))) } val PagedIds: Parser[Seq[String]] = for {