Skip to content

Fixes for sbt-dotty #2690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object Build {
// Override `launchIDE` from sbt-dotty to use the language-server and
// vscode extension from the source repository of dotty instead of a
// published version.
launchIDE := (run in `dotty-language-server`).dependsOn(prepareIDE).toTask("").value
launchIDE := (run in `dotty-language-server`).dependsOn(configureIDE).toTask("").value
)

// Only available in vscode-dotty
Expand Down Expand Up @@ -882,7 +882,7 @@ object Build {


sbtPlugin := true,
version := "0.1.1",
version := "0.1.2-SNAPSHOT",
ScriptedPlugin.scriptedSettings,
ScriptedPlugin.sbtTestDirectory := baseDirectory.value / "sbt-test",
ScriptedPlugin.scriptedBufferLog := false,
Expand Down
15 changes: 7 additions & 8 deletions sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ object DottyIDEPlugin extends AutoPlugin {
}

private val projectConfig = taskKey[Option[ProjectConfig]]("")
private val configureIDE = taskKey[Unit]("Generate IDE config files")
private val compileForIDE = taskKey[Unit]("Compile all projects supported by the IDE")
private val runCode = taskKey[Unit]("")

object autoImport {
val prepareIDE = taskKey[Unit]("Prepare for IDE launch")
val configureIDE = taskKey[Unit]("Generate IDE config files")
val launchIDE = taskKey[Unit]("Run Visual Studio Code on this project")
}

Expand All @@ -64,6 +63,11 @@ object DottyIDEPlugin extends AutoPlugin {
Def.derive(projectConfig := {
if (sources.value.isEmpty) None
else {
// Not needed to generate the config, but this guarantees that the
// generated config is usable by an IDE without any extra compilation
// step.
val _ = compile.value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different from what prepareIDE did before. It called compileForIDE.value, not compile.value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but all compileForIDE does is call compile on each dotty configuration, here we already are in a task run in every dotty configuration, so compile is fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK but then, why is compileForIDE still necessary? It doesn't seem to be called by anything.


val id = s"${thisProject.value.id}/${configuration.value.name}"
val compilerVersion = scalaVersion.value
.replace("-nonbootstrapped", "") // The language server is only published bootstrapped
Expand Down Expand Up @@ -135,11 +139,6 @@ object DottyIDEPlugin extends AutoPlugin {
.start()
},

prepareIDE := {
val x1 = configureIDE.value
val x2 = compileForIDE.value
},

launchIDE := runCode.dependsOn(prepareIDE).value
launchIDE := runCode.dependsOn(configureIDE).value
)
}