Skip to content

Commit

Permalink
Merge pull request #161 from atom-community/shutdownGracefully-config
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Jun 13, 2021
2 parents 4200aa2 + 14bec25 commit 1c2b2cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/auto-languageclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ export default class AutoLanguageClient {
(filepath) => this.filterChangeWatchedFiles(filepath),
this.reportBusyWhile,
this.getServerName(),
this.determineProjectPath
this.determineProjectPath,
this.shutdownGracefully
)
this._serverManager.startListening()
process.on("exit", () => this.exitCleanup.bind(this))
Expand Down Expand Up @@ -988,6 +989,12 @@ export default class AutoLanguageClient {
return true
}

/**
* If this is set to `true` (the default value), the servers will shut down gracefully. If it is set to `false`, the
* servers will be killed without awaiting shutdown response.
*/
protected shutdownGracefully: boolean = true

/**
* Called on language server stderr output.
*
Expand Down
5 changes: 3 additions & 2 deletions lib/server-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export class ServerManager {
private _changeWatchedFileFilter: (filePath: string) => boolean,
private _reportBusyWhile: ReportBusyWhile,
private _languageServerName: string,
private _determineProjectPath: (textEditor: TextEditor) => string | null
private _determineProjectPath: (textEditor: TextEditor) => string | null,
private shutdownGracefully: boolean
) {
this.updateNormalizedProjectPaths()
}
Expand Down Expand Up @@ -212,7 +213,7 @@ export class ServerManager {
this._activeServers.splice(this._activeServers.indexOf(server), 1)
this._stoppingServers.push(server)
server.disposable.dispose()
if (server.connection.isConnected) {
if (this.shutdownGracefully && server.connection.isConnected) {
await server.connection.shutdown()
}

Expand Down

0 comments on commit 1c2b2cd

Please sign in to comment.