(defaultCwdPath = "")
| 150 | } |
| 151 | |
| 152 | export const getWorkspacePath = (defaultCwdPath = "") => { |
| 153 | const firstFolderPath = |
| 154 | vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) || defaultCwdPath |
| 155 | |
| 156 | // Deterministic mode: always use the first workspace folder. |
| 157 | if (getRootResolutionStrategy() === "firstFolder") { |
| 158 | return firstFolderPath |
| 159 | } |
| 160 | |
| 161 | // Default behavior: prefer the workspace folder containing the active editor. |
| 162 | const currentFileUri = vscode.window.activeTextEditor?.document.uri |
| 163 | if (currentFileUri) { |
| 164 | const workspaceFolder = vscode.workspace.getWorkspaceFolder(currentFileUri) |
| 165 | return workspaceFolder?.uri.fsPath || firstFolderPath |
| 166 | } |
| 167 | return firstFolderPath |
| 168 | } |
| 169 | |
| 170 | export const getWorkspacePathForContext = (contextPath?: string): string => { |
| 171 | // In `firstFolder` mode the root is pinned to workspaceFolders[0], |
no test coverage detected