MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getWorkspacePathForContext

Function getWorkspacePathForContext

src/utils/path.ts:170–189  ·  view source on GitHub ↗
(contextPath?: string)

Source from the content-addressed store, hash-verified

168}
169
170export const getWorkspacePathForContext = (contextPath?: string): string => {
171 // In `firstFolder` mode the root is pinned to workspaceFolders[0],
172 // regardless of whichever file the caller is reasoning about.
173 if (getRootResolutionStrategy() === "firstFolder") {
174 return getWorkspacePath()
175 }
176
177 // If context path provided, find its workspace
178 if (contextPath) {
179 const workspaceFolder = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(contextPath))
180 if (workspaceFolder) {
181 return workspaceFolder.uri.fsPath
182 }
183 // Debug logging when falling back
184 console.debug(`[CodeIndex] No workspace found for context path: ${contextPath}, falling back to default`)
185 }
186
187 // Fall back to current behavior
188 return getWorkspacePath()
189}

Callers 2

path.spec.tsFile · 0.90
scanDirectoryMethod · 0.90

Calls 4

getWorkspacePathFunction · 0.85
fileMethod · 0.80
debugMethod · 0.65

Tested by

no test coverage detected