INNER CODE UNIT · TypeScript
selectProject
microsoft/vscode-react-native · src/extension/commands/util/index.ts:89
export async function selectProject(): Promise<AppLauncher> {
const logger = OutputChannelLogger.getMainChannel();
const projectKeys = Object.keys(ProjectsStorage.projectsCache);
if (projectKeys.length === 0) {
throw ErrorHelper.getInternalError(
InternalErrorCode.WorkspaceNotFound,
"Current workspace does not contain React Native projects.",
);
}
if (projectKeys.length === 1) {
logger.debug(`Command palette: once project ${projectKeys[0]}`);
return ProjectsStorage.projectsCache[projectKeys[0]];
}
const selected = await vscode.window.showQuickPick(projectKeys);