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

Function inferWorkspaceKind

src/cm/lsp/runtimeProviders.ts:167–194  ·  view source on GitHub ↗
(
	context: Pick<LspRuntimeContext, "uri" | "rootUri" | "file">,
)

Source from the content-addressed store, hash-verified

165}
166
167export function inferWorkspaceKind(
168 context: Pick<LspRuntimeContext, "uri" | "rootUri" | "file">,
169): WorkspaceKind {
170 const uri = String(context.rootUri || context.file?.uri || context.uri || "");
171 if (!uri) return "unknown";
172
173 const schemeMatch = /^([a-zA-Z][\w+\-.]*?):/.exec(uri);
174 const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : null;
175
176 if (!scheme) return uri.startsWith("/") ? "app-private" : "unknown";
177 if (scheme === "file") return "app-private";
178 if (scheme === "untitled") return "virtual";
179 if (
180 scheme === "ftp" ||
181 scheme === "sftp" ||
182 scheme === "http" ||
183 scheme === "https"
184 ) {
185 return "remote";
186 }
187 if (scheme !== "content") return "unknown";
188
189 if (/^content:\/\/com\.foxdebug\.acode(?:free)?\.documents\//i.test(uri)) {
190 return "builtin-alpine";
191 }
192 if (/termux/i.test(uri)) return "termux-saf";
193 return "saf";
194}
195
196export function isBuiltinAlpineAccessible(
197 context: Pick<LspRuntimeContext, "uri" | "rootUri" | "file">,

Callers 1

withDerivedContextFunction · 0.85

Calls 2

StringInterface · 0.85
execMethod · 0.65

Tested by

no test coverage detected