@@ -26,9 +26,6 @@ export let client: LanguageClient
2626/** The sbt process that may have been started by this extension */
2727let sbtProcess : ChildProcess | undefined
2828
29- /** The status bar where the show the status of sbt server */
30- let sbtStatusBar : vscode . StatusBarItem
31-
3229const sbtVersion = "1.2.3"
3330const sbtArtifact = `org.scala-sbt:sbt-launch:${ sbtVersion } `
3431export const workspaceRoot = `${ vscode . workspace . rootPath } `
@@ -95,11 +92,14 @@ export function activate(context: ExtensionContext) {
9592 return Promise . reject ( )
9693 }
9794 } )
95+ . then ( _ => connectToSbt ( coursierPath ) )
96+ . then ( sbt => {
97+ return withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) )
98+ . then ( _ => { sbtserver . tellSbt ( outputChannel , sbt , "exit" ) } )
99+ } )
98100 }
99101
100102 configuredProject
101- . then ( _ => connectToSbt ( coursierPath ) )
102- . then ( sbt => withProgress ( "Configuring Dotty IDE..." , configureIDE ( sbt ) ) )
103103 . then ( _ => runLanguageServer ( coursierPath , languageServerArtifactFile ) )
104104 }
105105}
@@ -109,34 +109,14 @@ export function activate(context: ExtensionContext) {
109109 * connection is still alive. If it dies, restart sbt server.
110110 */
111111function 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 ( )
115112
116113 return offeringToRetry ( ( ) => {
117114 return withSbtInstance ( coursierPath ) . then ( connection => {
118- connection . onClose ( ( ) => markSbtDownAndReconnect ( coursierPath ) )
119- markSbtUp ( )
120115 return connection
121116 } )
122117 } , "Couldn't connect to sbt server (see log for details)" )
123118}
124119
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-
140120export function deactivate ( ) {
141121 // If sbt was started by this extension, kill the process.
142122 // FIXME: This will be a problem for other clients of this server.
0 commit comments