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

Function setServerRuntime

src/cm/lsp/runtimeSettings.ts:94–124  ·  view source on GitHub ↗
(
	serverId: string,
	runtimeId: string,
)

Source from the content-addressed store, hash-verified

92}
93
94export async function setServerRuntime(
95 serverId: string,
96 runtimeId: string,
97): Promise<void> {
98 const normalizedServerId = String(serverId || "")
99 .trim()
100 .toLowerCase();
101 if (!normalizedServerId) throw new Error("Server id is required");
102
103 const current = appSettings.value?.lsp || {};
104 const currentRuntime = (current.runtime || {}) as RuntimeSettings;
105 const runtime = {
106 ...currentRuntime,
107 servers: {
108 ...(currentRuntime.servers || {}),
109 } as Record<string, string>,
110 };
111 const normalizedRuntimeId = toRuntimeId(runtimeId) || AUTO_RUNTIME_ID;
112 if (normalizedRuntimeId === AUTO_RUNTIME_ID) {
113 delete runtime.servers[normalizedServerId];
114 } else {
115 runtime.servers[normalizedServerId] = normalizedRuntimeId;
116 }
117
118 await appSettings.update({
119 lsp: {
120 ...current,
121 runtime,
122 },
123 });
124}
125
126export function getDefaultRuntimeSetting(): string {
127 return toRuntimeId(appSettings.value?.lsp?.runtime?.default) || AUTO_RUNTIME_ID;

Callers

nothing calls this directly

Calls 3

StringInterface · 0.85
toRuntimeIdFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected