Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add shutdown request to client
  • Loading branch information
thecrypticace committed May 28, 2025
commit 107b9de461cd971175e60c2a075d612a4aa2aa60
15 changes: 15 additions & 0 deletions packages/tailwindcss-language-server/tests/utils/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import {
DocumentLinkRequest,
DocumentSymbol,
DocumentSymbolRequest,
ExitNotification,
FileChangeType,
FileEvent,
Hover,
NotificationHandler,
ProtocolConnection,
PublishDiagnosticsParams,
Registration,
ShutdownRequest,
SymbolInformation,
UnregistrationRequest,
WorkspaceFolder,
Expand Down Expand Up @@ -226,6 +228,11 @@ export interface Client extends ClientWorkspace {
* Update the global settings for the server
*/
updateSettings(settings: DeepPartial<Settings>): Promise<void>

/**
* Shutdown the server
*/
shutdown(): Promise<void>
}

export interface ClientWorkspaceOptions {
Expand Down Expand Up @@ -567,6 +574,13 @@ export async function createClient(opts: ClientOptions): Promise<Client> {
})
}

let didExit = new Promise<void>((resolve) => conn.onNotification(ExitNotification.type, resolve))

async function shutdown() {
await conn.sendRequest(ShutdownRequest.type)
await didExit
}

return {
...clientWorkspaces[0],
get serverCapabilities() {
Expand All @@ -576,6 +590,7 @@ export async function createClient(opts: ClientOptions): Promise<Client> {
notifyChangedFiles,
workspace,
updateSettings,
shutdown,
}
}

Expand Down