Skip to content

Commit 2a631cb

Browse files
authored
Fix: add bsp dispose method (#1543)
1 parent 7f2f6d6 commit 2a631cb

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

extension/src/bs/BspProxy.ts

+6
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,10 @@ export class BspProxy {
8686
// TODO: Implement more specific error handling logic here
8787
});
8888
}
89+
90+
public closeConnection(): void {
91+
this.buildServerConnector.close();
92+
this.jdtlsImporterConnector.close();
93+
this.logger.info("Build Server connection closed");
94+
}
8995
}

extension/src/bs/BuildServerConnector.ts

+6
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@ export class BuildServerConnector {
3434
public getServerPipePath(): string {
3535
return this.serverPipePath;
3636
}
37+
38+
public close(): void {
39+
this.serverConnection?.end();
40+
this.serverConnection?.dispose();
41+
this.serverPipeServer.close();
42+
}
3743
}

extension/src/bs/JdtlsImporterConnector.ts

+6
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,10 @@ export class JdtlsImporterConnector {
6868
public getImporterConnection(): rpc.MessageConnection | null {
6969
return this.importerConnection;
7070
}
71+
72+
public close(): void {
73+
this.importerConnection?.end();
74+
this.importerConnection?.dispose();
75+
this.importerPipeServer.close();
76+
}
7177
}

extension/src/server/GradleServer.ts

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export class GradleServer {
8888
this._onDidStop.fire(null);
8989
this.ready = false;
9090
this.process?.removeAllListeners();
91+
this.bspProxy.closeConnection();
9192
if (this.restarting) {
9293
this.restarting = false;
9394
await this.start();
@@ -163,6 +164,7 @@ export class GradleServer {
163164
}
164165

165166
public async asyncDispose(): Promise<void> {
167+
this.bspProxy.closeConnection();
166168
this.process?.removeAllListeners();
167169
await this.killProcess();
168170
this.ready = false;

0 commit comments

Comments
 (0)