3
3
import * as fs from 'fs' ;
4
4
import * as path from 'path' ;
5
5
6
- import * as cpp from 'promisify-child-process' ;
6
+ import * as pcp from 'promisify-child-process' ;
7
7
import * as compareVersions from 'compare-versions' ;
8
8
9
9
import { ChildProcess } from "child_process" ;
@@ -39,11 +39,10 @@ const sbtBuildPropertiesFile = path.join(sbtProjectDir, "build.properties")
39
39
const sbtBuildSbtFile = path . join ( workspaceRoot , "build.sbt" )
40
40
const languageServerArtifactFile = path . join ( workspaceRoot , ".dotty-ide-artifact" )
41
41
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 )
47
46
)
48
47
}
49
48
@@ -83,7 +82,7 @@ export function activate(context: ExtensionContext) {
83
82
84
83
} else {
85
84
let configuredProject : Thenable < void > = Promise . resolve ( )
86
- if ( isUnconfiguredProject ( ) ) {
85
+ if ( ! isConfiguredProject ( ) ) {
87
86
configuredProject = vscode . window . showInformationMessage (
88
87
"This looks like an unconfigured Scala project. Would you like to start the Dotty IDE?" ,
89
88
"Yes" , "No"
@@ -98,10 +97,12 @@ export function activate(context: ExtensionContext) {
98
97
} )
99
98
}
100
99
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
+ }
105
106
}
106
107
}
107
108
@@ -220,7 +221,7 @@ function runLanguageServer(coursierPath: string, languageServerArtifactFile: str
220
221
221
222
function startNewSbtInstance ( coursierPath : string ) {
222
223
fetchWithCoursier ( coursierPath , sbtArtifact ) . then ( ( sbtClasspath ) => {
223
- sbtProcess = cpp . spawn ( "java" , [
224
+ sbtProcess = pcp . spawn ( "java" , [
224
225
"-Dsbt.log.noformat=true" ,
225
226
"-classpath" , sbtClasspath ,
226
227
"xsbt.boot.Boot"
@@ -265,7 +266,7 @@ function fetchWithCoursier(coursierPath: string, artifact: string, extra: string
265
266
"-p" ,
266
267
artifact
267
268
] . concat ( extra )
268
- const coursierProc = cpp . spawn ( "java" , args )
269
+ const coursierProc = pcp . spawn ( "java" , args )
269
270
270
271
let classPath = ""
271
272
0 commit comments