@@ -27,12 +27,6 @@ let sbtProcess: ChildProcess | undefined
2727/** The status bar where the show the status of sbt server */
2828let sbtStatusBar : vscode . StatusBarItem
2929
30- /** Interval in ms to check that sbt is alive */
31- const sbtCheckIntervalMs = 10 * 1000
32-
33- /** A command that we use to check that sbt is still alive. */
34- export const nopCommand = "nop"
35-
3630const sbtVersion = "1.2.3"
3731const sbtArtifact = `org.scala-sbt:sbt-launch:${ sbtVersion } `
3832const workspaceRoot = `${ vscode . workspace . rootPath } `
@@ -108,8 +102,8 @@ function connectToSbt(coursierPath: string): Thenable<rpc.MessageConnection> {
108102
109103 return offeringToRetry ( ( ) => {
110104 return withSbtInstance ( coursierPath ) . then ( connection => {
105+ connection . onClose ( ( ) => markSbtDownAndReconnect ( coursierPath ) )
111106 markSbtUp ( )
112- const interval = setInterval ( ( ) => checkSbt ( interval , connection , coursierPath ) , sbtCheckIntervalMs )
113107 return connection
114108 } )
115109 } , "Couldn't connect to sbt server (see log for details)" )
@@ -130,16 +124,6 @@ function markSbtDownAndReconnect(coursierPath: string) {
130124 connectToSbt ( coursierPath )
131125}
132126
133- /** Check that sbt is alive, try to reconnect if it is dead. */
134- function checkSbt ( interval : NodeJS . Timer , connection : rpc . MessageConnection , coursierPath : string ) {
135- sbtserver . tellSbt ( outputChannel , connection , nopCommand )
136- . then ( _ => markSbtUp ( ) ,
137- _ => {
138- clearInterval ( interval )
139- markSbtDownAndReconnect ( coursierPath )
140- } )
141- }
142-
143127export function deactivate ( ) {
144128 // If sbt was started by this extension, kill the process.
145129 // FIXME: This will be a problem for other clients of this server.
0 commit comments