()
| 1475 | } |
| 1476 | |
| 1477 | async function resolveProjectForResource(): Promise<ProjectState | undefined> { |
| 1478 | const activeProject = activeProjectKey ? getTrackedRootPathByKey(activeProjectKey) : undefined; |
| 1479 | if (activeProject) { |
| 1480 | const project = getOrCreateProject(activeProject); |
| 1481 | await initProject(project.rootPath, watcherDebounceMs, { enableWatcher: true }); |
| 1482 | touchProject(project.rootPath); |
| 1483 | return project; |
| 1484 | } |
| 1485 | |
| 1486 | const availableProjects = listProjectDescriptors(); |
| 1487 | if (availableProjects.length !== 1) { |
| 1488 | return undefined; |
| 1489 | } |
| 1490 | |
| 1491 | const project = getOrCreateProject(availableProjects[0].rootPath); |
| 1492 | await initProject(project.rootPath, watcherDebounceMs, { enableWatcher: true }); |
| 1493 | setActiveProject(project.rootPath); |
| 1494 | return project; |
| 1495 | } |
| 1496 | |
| 1497 | /** |
| 1498 | * Initialize a project: migrate legacy structure, check index, start watcher. |
no test coverage detected