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

Function updateServerConfig

src/settings/lspConfigUtils.js:39–66  ·  view source on GitHub ↗
(serverId, partial)

Source from the content-addressed store, hash-verified

37}
38
39export async function updateServerConfig(serverId, partial) {
40 const key = normalizeServerId(serverId);
41 if (!key) {
42 throw new Error("Server id is required");
43 }
44
45 const current = cloneLspSettings();
46 current.servers = current.servers || {};
47 const nextServer = {
48 ...(current.servers[key] || {}),
49 };
50
51 Object.entries(partial || {}).forEach(([entryKey, value]) => {
52 if (value === undefined) {
53 delete nextServer[entryKey];
54 return;
55 }
56 nextServer[entryKey] = value;
57 });
58
59 if (Object.keys(nextServer).length) {
60 current.servers[key] = nextServer;
61 } else {
62 delete current.servers[key];
63 }
64
65 await appSettings.update({ lsp: current }, false);
66}
67
68export async function upsertCustomServer(serverId, config) {
69 const key = normalizeServerId(serverId);

Callers 4

persistEnabledFunction · 0.90
persistClientConfigFunction · 0.90
persistStartupTimeoutFunction · 0.90
persistInitOptionsFunction · 0.90

Calls 3

normalizeServerIdFunction · 0.85
cloneLspSettingsFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected