33import * as fs from 'fs' ;
44import * as path from 'path' ;
55
6- import * as cpp from 'promisify-child-process' ;
6+ import * as pcp from 'promisify-child-process' ;
77import * as compareVersions from 'compare-versions' ;
88
99import { ChildProcess } from "child_process" ;
@@ -39,11 +39,10 @@ const sbtBuildPropertiesFile = path.join(sbtProjectDir, "build.properties")
3939const sbtBuildSbtFile = path . join ( workspaceRoot , "build.sbt" )
4040const languageServerArtifactFile = path . join ( workspaceRoot , ".dotty-ide-artifact" )
4141
42- function isUnconfiguredProject ( ) {
43- return ! ( fs . existsSync ( disableDottyIDEFile )
44- || fs . existsSync ( sbtPluginFile )
45- || fs . existsSync ( sbtBuildPropertiesFile )
46- || fs . existsSync ( sbtBuildSbtFile )
42+ function isConfiguredProject ( ) {
43+ return ( fs . existsSync ( sbtPluginFile )
44+ || fs . existsSync ( sbtBuildPropertiesFile )
45+ || fs . existsSync ( sbtBuildSbtFile )
4746 )
4847}
4948
@@ -83,7 +82,7 @@ export function activate(context: ExtensionContext) {
8382
8483 } else {
8584 let configuredProject : Thenable < void > = Promise . resolve ( )
86- if ( isUnconfiguredProject ( ) ) {
85+ if ( ! isConfiguredProject ( ) ) {
8786 configuredProject = vscode . window . showInformationMessage (
8887 "This looks like an unconfigured Scala project. Would you like to start the Dotty IDE?" ,
8988 "Yes" , "No"
@@ -98,10 +97,12 @@ export function activate(context: ExtensionContext) {
9897 } )
9998 }
10099
101- configuredProject
102- . then ( _ => connectToSbt ( coursierPath ) )
103- . then ( sbt => withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) ) )
104- . then ( _ => runLanguageServer ( coursierPath , languageServerArtifactFile ) )
100+ if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
101+ configuredProject
102+ . then ( _ => connectToSbt ( coursierPath ) )
103+ . then ( sbt => withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) ) )
104+ . then ( _ => runLanguageServer ( coursierPath , languageServerArtifactFile ) )
105+ }
105106 }
106107}
107108
@@ -220,7 +221,7 @@ function runLanguageServer(coursierPath: string, languageServerArtifactFile: str
220221
221222function startNewSbtInstance ( coursierPath : string ) {
222223 fetchWithCoursier ( coursierPath , sbtArtifact ) . then ( ( sbtClasspath ) => {
223- sbtProcess = cpp . spawn ( "java" , [
224+ sbtProcess = pcp . spawn ( "java" , [
224225 "-Dsbt.log.noformat=true" ,
225226 "-classpath" , sbtClasspath ,
226227 "xsbt.boot.Boot"
@@ -265,7 +266,7 @@ function fetchWithCoursier(coursierPath: string, artifact: string, extra: string
265266 "-p" ,
266267 artifact
267268 ] . concat ( extra )
268- const coursierProc = cpp . spawn ( "java" , args )
269+ const coursierProc = pcp . spawn ( "java" , args )
269270
270271 let classPath = ""
271272
0 commit comments