Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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