(contextPath?: string)
| 168 | } |
| 169 | |
| 170 | export 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 | } |
no test coverage detected