@@ -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,11 +92,14 @@ export function activate(context: ExtensionContext) {
95
92
return Promise . reject ( )
96
93
}
97
94
} )
95
+ . then ( _ => connectToSbt ( coursierPath ) )
96
+ . then ( sbt => {
97
+ return withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) )
98
+ . then ( _ => { sbtserver . tellSbt ( outputChannel , sbt , "exit" ) } )
99
+ } )
98
100
}
99
101
100
102
configuredProject
101
- . then ( _ => connectToSbt ( coursierPath ) )
102
- . then ( sbt => withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) ) )
103
103
. then ( _ => runLanguageServer ( coursierPath , languageServerArtifactFile ) )
104
104
}
105
105
}
@@ -109,34 +109,14 @@ export function activate(context: ExtensionContext) {
109
109
* connection is still alive. If it dies, restart sbt server.
110
110
*/
111
111
function connectToSbt ( coursierPath : string ) : Thenable < rpc . MessageConnection > {
112
- if ( ! sbtStatusBar ) sbtStatusBar = vscode . window . createStatusBarItem ( vscode . StatusBarAlignment . Right )
113
- sbtStatusBar . text = "sbt server: connecting $(sync)"
114
- sbtStatusBar . show ( )
115
112
116
113
return offeringToRetry ( ( ) => {
117
114
return withSbtInstance ( coursierPath ) . then ( connection => {
118
- connection . onClose ( ( ) => markSbtDownAndReconnect ( coursierPath ) )
119
- markSbtUp ( )
120
115
return connection
121
116
} )
122
117
} , "Couldn't connect to sbt server (see log for details)" )
123
118
}
124
119
125
- /** Mark sbt server as alive in the status bar */
126
- function markSbtUp ( ) {
127
- sbtStatusBar . text = "sbt server: up $(check)"
128
- }
129
-
130
- /** Mark sbt server as dead and try to reconnect */
131
- function markSbtDownAndReconnect ( coursierPath : string ) {
132
- sbtStatusBar . text = "sbt server: down $(x)"
133
- if ( sbtProcess ) {
134
- sbtProcess . kill ( )
135
- sbtProcess = undefined
136
- }
137
- connectToSbt ( coursierPath )
138
- }
139
-
140
120
export function deactivate ( ) {
141
121
// If sbt was started by this extension, kill the process.
142
122
// FIXME: This will be a problem for other clients of this server.
0 commit comments