* Read the `zoo-code.workspace.rootResolution` setting safely. * * Wrapped in try/catch because: * 1. `vscode.workspace.getConfiguration` is unavailable in some test/CLI * execution contexts. * 2. The path utilities are imported very early during extension activation, * so we mus
()
| 139 | * so we must never throw from a config read. |
| 140 | */ |
| 141 | function getRootResolutionStrategy(): WorkspaceRootResolution { |
| 142 | try { |
| 143 | const value = vscode.workspace |
| 144 | .getConfiguration(Package.name) |
| 145 | .get<string>("workspace.rootResolution", DEFAULT_ROOT_RESOLUTION) |
| 146 | return value === "firstFolder" ? "firstFolder" : DEFAULT_ROOT_RESOLUTION |
| 147 | } catch { |
| 148 | return DEFAULT_ROOT_RESOLUTION |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | export const getWorkspacePath = (defaultCwdPath = "") => { |
| 153 | const firstFolderPath = |
no test coverage detected