Skip to content

Commit 1c2b2cd

Browse files
authored
Merge pull request #161 from atom-community/shutdownGracefully-config
2 parents 4200aa2 + 14bec25 commit 1c2b2cd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/auto-languageclient.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ export default class AutoLanguageClient {
315315
(filepath) => this.filterChangeWatchedFiles(filepath),
316316
this.reportBusyWhile,
317317
this.getServerName(),
318-
this.determineProjectPath
318+
this.determineProjectPath,
319+
this.shutdownGracefully
319320
)
320321
this._serverManager.startListening()
321322
process.on("exit", () => this.exitCleanup.bind(this))
@@ -988,6 +989,12 @@ export default class AutoLanguageClient {
988989
return true
989990
}
990991

992+
/**
993+
* If this is set to `true` (the default value), the servers will shut down gracefully. If it is set to `false`, the
994+
* servers will be killed without awaiting shutdown response.
995+
*/
996+
protected shutdownGracefully: boolean = true
997+
991998
/**
992999
* Called on language server stderr output.
9931000
*

lib/server-manager.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export class ServerManager {
5050
private _changeWatchedFileFilter: (filePath: string) => boolean,
5151
private _reportBusyWhile: ReportBusyWhile,
5252
private _languageServerName: string,
53-
private _determineProjectPath: (textEditor: TextEditor) => string | null
53+
private _determineProjectPath: (textEditor: TextEditor) => string | null,
54+
private shutdownGracefully: boolean
5455
) {
5556
this.updateNormalizedProjectPaths()
5657
}
@@ -212,7 +213,7 @@ export class ServerManager {
212213
this._activeServers.splice(this._activeServers.indexOf(server), 1)
213214
this._stoppingServers.push(server)
214215
server.disposable.dispose()
215-
if (server.connection.isConnected) {
216+
if (this.shutdownGracefully && server.connection.isConnected) {
216217
await server.connection.shutdown()
217218
}
218219

0 commit comments

Comments
 (0)