Skip to content

Commit 6fd30e8

Browse files
committed
Update load-plugin
Use `if-absent` so that we don't load the plugins and apply transformations to the build if this is not necessary.
1 parent 920fb74 commit 6fd30e8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

vscode-dotty/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"vscode:prepublish": "npm install && ./node_modules/.bin/tsc -p ./",
5252
"compile": "./node_modules/.bin/tsc -p ./",
5353
"test": "node ./node_modules/vscode/bin/test",
54-
"postinstall": "node ./node_modules/vscode/bin/install && curl -L -o out/coursier https://github.com/coursier/coursier/raw/v1.0.0/coursier && curl -L -o out/load-plugin.jar https://github.com/scalacenter/load-plugin/releases/download/v0.1.0/load-plugin_2.12-0.1.0.jar"
54+
"postinstall": "node ./node_modules/vscode/bin/install && curl -L -o out/coursier https://github.com/coursier/coursier/raw/v1.0.0/coursier && curl -L -o out/load-plugin.jar https://oss.sonatype.org/content/repositories/releases/ch/epfl/scala/load-plugin_2.12/0.1.0+2-496ac670/load-plugin_2.12-0.1.0+2-496ac670.jar"
5555
},
5656
"extensionDependencies": [
5757
"daltonjorge.scala"

vscode-dotty/src/extension.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,21 @@ function configureIDE() {
9494
title: 'Configuring IDE...'
9595
}, (progress) => {
9696

97+
const applyLoadPlugin = "apply -cp " + loadPluginPath + " ch.epfl.scala.loadplugin.LoadPlugin"
98+
const ifAbsentCommands = [
99+
"if-absent dotty.tools.sbtplugin.DottyPlugin",
100+
"\"set every scalaVersion := \\\"0.8.0-bin-SNAPSHOT\\\"\"",
101+
"\"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyPlugin\"",
102+
"\"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyIDEPlugin\""
103+
].join(" ")
104+
97105
const sbtPromise =
98106
cpp.spawn("java", [
99107
"-jar", coursierPath,
100108
"launch",
101109
"org.scala-sbt:sbt-launch:1.1.2", "--",
102-
"apply -cp " + loadPluginPath + " ch.epfl.scala.loadplugin.LoadPlugin",
103-
"set every scalaVersion := \"0.8.0-bin-SNAPSHOT\"",
104-
"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyPlugin",
105-
"load-plugin ch.epfl.lamp:sbt-dotty:0.2.0-SNAPSHOT dotty.tools.sbtplugin.DottyIDEPlugin",
110+
applyLoadPlugin,
111+
ifAbsentCommands,
106112
"configureIDE"
107113
])
108114
const sbtProc = sbtPromise.childProcess

0 commit comments

Comments
 (0)