Skip to content

Commit 107b9de

Browse files
committed
Add shutdown request to client
1 parent 0f80cc0 commit 107b9de

File tree

1 file changed

+15
-0
lines changed
  • packages/tailwindcss-language-server/tests/utils

1 file changed

+15
-0
lines changed

packages/tailwindcss-language-server/tests/utils/client.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ import {
1212
DocumentLinkRequest,
1313
DocumentSymbol,
1414
DocumentSymbolRequest,
15+
ExitNotification,
1516
FileChangeType,
1617
FileEvent,
1718
Hover,
1819
NotificationHandler,
1920
ProtocolConnection,
2021
PublishDiagnosticsParams,
2122
Registration,
23+
ShutdownRequest,
2224
SymbolInformation,
2325
UnregistrationRequest,
2426
WorkspaceFolder,
@@ -226,6 +228,11 @@ export interface Client extends ClientWorkspace {
226228
* Update the global settings for the server
227229
*/
228230
updateSettings(settings: DeepPartial<Settings>): Promise<void>
231+
232+
/**
233+
* Shutdown the server
234+
*/
235+
shutdown(): Promise<void>
229236
}
230237

231238
export interface ClientWorkspaceOptions {
@@ -567,6 +574,13 @@ export async function createClient(opts: ClientOptions): Promise<Client> {
567574
})
568575
}
569576

577+
let didExit = new Promise<void>((resolve) => conn.onNotification(ExitNotification.type, resolve))
578+
579+
async function shutdown() {
580+
await conn.sendRequest(ShutdownRequest.type)
581+
await didExit
582+
}
583+
570584
return {
571585
...clientWorkspaces[0],
572586
get serverCapabilities() {
@@ -576,6 +590,7 @@ export async function createClient(opts: ClientOptions): Promise<Client> {
576590
notifyChangedFiles,
577591
workspace,
578592
updateSettings,
593+
shutdown,
579594
}
580595
}
581596

0 commit comments

Comments
 (0)