summaryrefslogtreecommitdiff
path: root/build.sbt
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-02-06 23:01:05 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-02-06 23:01:05 +1000
commitfcaa3ab36f934ccd1b6cd6098ed62fdf49981dbc (patch)
treedd9abf0fd5444157b4c07313a7094746f41ced46 /build.sbt
parentb51fe3d4d01405a0bcfc586af337736cfe4e0478 (diff)
downloadscala-fcaa3ab36f934ccd1b6cd6098ed62fdf49981dbc.tar.gz
scala-fcaa3ab36f934ccd1b6cd6098ed62fdf49981dbc.tar.bz2
scala-fcaa3ab36f934ccd1b6cd6098ed62fdf49981dbc.zip
Add tab completion to the partest command
We can complete partest options (I've excluded some that aren't relevant in SBT), as well as test file names. If `--srcpath scaladoc` is included, completion of test paths will be based on `test/scaladoc` rather than the default `test/files`. Note that the `--srcpath` option is currently broken via scala partest interface, this change to scala-partest is needed to make it work: https://github.com/scala/scala-partest/pull/49 I've also hijacked the `--grep` option with logic in the SBT command itself, rather than passing this to `partest`. Just like `./bin/partest-ack`, this looks for either test file names or regex matches within the contents of test, check, or flag files. I tried for some time to make the tab completion of thousands of filenames more user friendly, but wasn't able to get something working. Ideally, it should only suggest to `test/files/{pos, neg, ...}` on the first <TAB>, and then offer files on another TAB. Files should also be offered if a full directory has been entered. Hopefully a SBT parser guru will step in and add some polish here.
Diffstat (limited to 'build.sbt')
-rw-r--r--build.sbt6
1 files changed, 5 insertions, 1 deletions
diff --git a/build.sbt b/build.sbt
index fa1c9835fa..a752a33315 100644
--- a/build.sbt
+++ b/build.sbt
@@ -836,4 +836,8 @@ addCommandAlias("scalac", "compiler/compile:runMain scala.tools.nsc
addCommandAlias("scala", "repl-jline-embedded/compile:runMain scala.tools.nsc.MainGenericRunner -usejavacp")
addCommandAlias("scaladoc", "scaladoc/compile:runMain scala.tools.nsc.ScalaDoc -usejavacp")
addCommandAlias("scalap", "scalap/compile:runMain scala.tools.scalap.Main -usejavacp")
-addCommandAlias("partest", "test/it:testOnly --")
+
+// Add tab completion to partest
+commands += Command("partest")(_ => PartestUtil.partestParser((baseDirectory in ThisBuild).value, (baseDirectory in ThisBuild).value / "test")) { (state, parsed) =>
+ ("test/it:testOnly -- " + parsed):: state
+}