| 373 | ) => Partial<LspServerDefinition> | null; |
| 374 | |
| 375 | export function updateServer( |
| 376 | id: string, |
| 377 | updater: ServerUpdater, |
| 378 | ): LspServerDefinition | null { |
| 379 | const key = toKey(id); |
| 380 | if (!key || !registry.has(key)) return null; |
| 381 | const current = registry.get(key); |
| 382 | if (!current) return null; |
| 383 | const next = updater({ ...current }); |
| 384 | if (!next) return current; |
| 385 | const normalized = sanitizeDefinition({ |
| 386 | ...current, |
| 387 | ...next, |
| 388 | id: current.id, |
| 389 | }); |
| 390 | registry.set(key, normalized); |
| 391 | notify("update", normalized); |
| 392 | return normalized; |
| 393 | } |
| 394 | |
| 395 | export function getServer(id: string): LspServerDefinition | null { |
| 396 | return registry.get(toKey(id)) ?? null; |