MCPcopy Index your code
hub / github.com/codeaashu/claude-code / reinitializeLspServerManager

Function reinitializeLspServerManager

src/services/lsp/manager.ts:226–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224 * init: the generation counter invalidates the in-flight promise.
225 */
226export function reinitializeLspServerManager(): void {
227 if (initializationState === 'not-started') {
228 // initializeLspServerManager() was never called (e.g. headless subcommand
229 // path). Don't start it now.
230 return
231 }
232
233 logForDebugging('[LSP MANAGER] reinitializeLspServerManager() called')
234
235 // Best-effort shutdown of any running servers on the old instance so
236 // /reload-plugins doesn't leak child processes. Fire-and-forget: the
237 // primary use case (issue #15521) has 0 servers so this is usually a no-op.
238 if (lspManagerInstance) {
239 void lspManagerInstance.shutdown().catch(err => {
240 logForDebugging(
241 `[LSP MANAGER] old instance shutdown during reinit failed: ${errorMessage(err)}`,
242 )
243 })
244 }
245
246 // Force the idempotence check in initializeLspServerManager() to fall
247 // through. Generation counter handles invalidating any in-flight init.
248 lspManagerInstance = undefined
249 initializationState = 'not-started'
250 initializationError = undefined
251
252 initializeLspServerManager()
253}
254
255/**
256 * Shutdown the LSP server manager and clean up resources.

Callers 2

refreshActivePluginsFunction · 0.85
useManagePluginsFunction · 0.85

Calls 4

logForDebuggingFunction · 0.85
errorMessageFunction · 0.50
shutdownMethod · 0.45

Tested by

no test coverage detected