@@ -15,6 +15,7 @@ import sbt.Package.ManifestAttributes
1515import com .typesafe .sbteclipse .plugin .EclipsePlugin ._
1616
1717import dotty .tools .sbtplugin .DottyPlugin .autoImport ._
18+ import dotty .tools .sbtplugin .DottyIDEPlugin .runProcess
1819import dotty .tools .sbtplugin .DottyIDEPlugin .autoImport ._
1920import org .scalajs .sbtplugin .ScalaJSPlugin
2021import org .scalajs .sbtplugin .ScalaJSPlugin .autoImport ._
@@ -766,8 +767,13 @@ object Build {
766767 val mainClass = " dotty.tools.languageserver.Main"
767768 val extensionPath = (baseDirectory in `vscode-dotty`).value.getAbsolutePath
768769
769- val codeArgs = if (inputArgs.isEmpty) List ((baseDirectory.value / " .." ).getAbsolutePath) else inputArgs
770- val allArgs = List (" -client_command" , " code" , s " --extensionDevelopmentPath= $extensionPath" ) ++ codeArgs
770+ val codeArgs =
771+ s " --extensionDevelopmentPath= $extensionPath" +:
772+ (if (inputArgs.isEmpty) List ((baseDirectory.value / " .." ).getAbsolutePath) else inputArgs)
773+
774+ val clientCommand = codeCommand.value ++ codeArgs
775+
776+ val allArgs = " -client_command" +: clientCommand
771777
772778 runTask(Runtime , mainClass, allArgs : _* )
773779 }.dependsOn(compile in (`vscode-dotty`, Compile )).evaluated
@@ -893,7 +899,7 @@ object Build {
893899
894900
895901 sbtPlugin := true ,
896- version := " 0.1.2 " ,
902+ version := " 0.1.3-SNAPSHOT " ,
897903 ScriptedPlugin .scriptedSettings,
898904 ScriptedPlugin .sbtTestDirectory := baseDirectory.value / " sbt-test" ,
899905 ScriptedPlugin .scriptedBufferLog := false ,
@@ -944,12 +950,7 @@ object Build {
944950 // Currently, vscode-dotty depends on daltonjorge.scala for syntax highlighting,
945951 // this is not automatically installed when starting the extension in development mode
946952 // (--extensionDevelopmentPath=...)
947- val exitCodeInstall = new java.lang.ProcessBuilder (" code" , " --install-extension" , " daltonjorge.scala" )
948- .inheritIO()
949- .start()
950- .waitFor()
951- if (exitCodeInstall != 0 )
952- throw new MessageOnlyException (" Installing dependency daltonjorge.scala failed" )
953+ runProcess(codeCommand.value ++ Seq (" --install-extension" , " daltonjorge.scala" ), wait = true )
953954
954955 sbt.inc.Analysis .Empty
955956 },
@@ -986,14 +987,9 @@ object Build {
986987 val inputArgs = spaceDelimited(" <arg>" ).parsed
987988 val codeArgs = if (inputArgs.isEmpty) List ((baseDirectory.value / " .." ).getAbsolutePath) else inputArgs
988989 val extensionPath = baseDirectory.value.getAbsolutePath
989- val processArgs = List (" code " , s " --extensionDevelopmentPath= ${extensionPath}" ) ++ codeArgs
990+ val processArgs = List (s " --extensionDevelopmentPath= ${extensionPath}" ) ++ codeArgs
990991
991- val exitCode = new java.lang.ProcessBuilder (processArgs : _* )
992- .inheritIO()
993- .start()
994- .waitFor()
995- if (exitCode != 0 )
996- throw new MessageOnlyException (" Running Visual Studio Code failed" )
992+ runProcess(codeCommand.value ++ processArgs, wait = true )
997993 }.dependsOn(compile in Compile ).evaluated
998994 )
999995
0 commit comments