Skip to content

Commit 8a42e27

Browse files
authored
Merge pull request #2841 from amanjpro/fix/issue-2828
Print nicer messages for missing vs code
2 parents 1c9552b + 7da5584 commit 8a42e27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala

+13-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,19 @@ object DottyIDEPlugin extends AutoPlugin {
234234
},
235235

236236
runCode := {
237-
runProcess(codeCommand.value ++ Seq("--install-extension", "lampepfl.dotty"), wait = true)
238-
runProcess(codeCommand.value ++ Seq("."), directory = baseDirectory.value)
237+
try {
238+
runProcess(codeCommand.value ++ Seq("--install-extension", "lampepfl.dotty"), wait = true)
239+
runProcess(codeCommand.value ++ Seq("."), directory = baseDirectory.value)
240+
} catch {
241+
case ioex: IOException if ioex.getMessage.startsWith("""Cannot run program "code"""") =>
242+
throw new MessageOnlyException(
243+
"""Could not find Visual Studio Code on your system.
244+
|Please download it at (https://code.visualstudio.com/) and add it to your path and then rerun launchIDE
245+
|
246+
|For Linux: https://code.visualstudio.com/docs/setup/linux
247+
|For Windows: https://code.visualstudio.com/docs/setup/windows
248+
|For Mac: https://code.visualstudio.com/docs/setup/mac""".stripMargin)
249+
}
239250
}
240251

241252
) ++ addCommandAlias("launchIDE", ";configureIDE;runCode")

0 commit comments

Comments
 (0)