@@ -26,9 +26,6 @@ export let client: LanguageClient
26
26
/** The sbt process that may have been started by this extension */
27
27
let sbtProcess : ChildProcess | undefined
28
28
29
- /** The status bar where the show the status of sbt server */
30
- let sbtStatusBar : vscode . StatusBarItem
31
-
32
29
const sbtVersion = "1.2.3"
33
30
const sbtArtifact = `org.scala-sbt:sbt-launch:${ sbtVersion } `
34
31
export const workspaceRoot = `${ vscode . workspace . rootPath } `
@@ -95,12 +92,15 @@ export function activate(context: ExtensionContext) {
95
92
return Promise . reject ( )
96
93
}
97
94
} )
95
+ . then ( _ => connectToSbt ( coursierPath ) )
96
+ . then ( sbt => {
97
+ withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) )
98
+ . then ( _ => sbtserver . tellSbt ( outputChannel , sbt , "exit" ) )
99
+ } )
98
100
}
99
101
100
102
if ( ! fs . existsSync ( disableDottyIDEFile ) ) {
101
103
configuredProject
102
- . then ( _ => connectToSbt ( coursierPath ) )
103
- . then ( sbt => withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) ) )
104
104
. then ( _ => runLanguageServer ( coursierPath , languageServerArtifactFile ) )
105
105
}
106
106
}
@@ -111,34 +111,14 @@ export function activate(context: ExtensionContext) {
111
111
* connection is still alive. If it dies, restart sbt server.
112
112
*/
113
113
function connectToSbt ( coursierPath : string ) : Thenable < rpc . MessageConnection > {
114
- if ( ! sbtStatusBar ) sbtStatusBar = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Right )
115
- sbtStatusBar . text = "sbt server: connecting $(sync)"
116
- sbtStatusBar . show ( )
117
114
118
115
return offeringToRetry ( ( ) => {
119
116
return withSbtInstance ( coursierPath ) . then ( connection => {
120
- connection . onClose ( ( ) => markSbtDownAndReconnect ( coursierPath ) )
121
- markSbtUp ( )
122
117
return connection
123
118
} )
124
119
} , "Couldn't connect to sbt server (see log for details)" )
125
120
}
126
121
127
- /** Mark sbt server as alive in the status bar */
128
- function markSbtUp ( ) {
129
- sbtStatusBar . text = "sbt server: up $(check)"
130
- }
131
-
132
- /** Mark sbt server as dead and try to reconnect */
133
- function markSbtDownAndReconnect ( coursierPath : string ) {
134
- sbtStatusBar . text = "sbt server: down $(x)"
135
- if ( sbtProcess ) {
136
- sbtProcess . kill ( )
137
- sbtProcess = undefined
138
- }
139
- connectToSbt ( coursierPath )
140
- }
141
-
142
122
export function deactivate ( ) {
143
123
// If sbt was started by this extension, kill the process.
144
124
// FIXME: This will be a problem for other clients of this server.
0 commit comments