MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / updateServer

Function updateServer

src/cm/lsp/serverRegistry.ts:375–393  ·  view source on GitHub ↗
(
	id: string,
	updater: ServerUpdater,
)

Source from the content-addressed store, hash-verified

373) => Partial<LspServerDefinition> | null;
374
375export 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
395export function getServer(id: string): LspServerDefinition | null {
396 return registry.get(toKey(id)) ?? null;

Callers 1

updateFunction · 0.90

Calls 5

sanitizeDefinitionFunction · 0.85
setMethod · 0.80
toKeyFunction · 0.70
notifyFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected