* Gets the top-level files and directories in the current working directory * @returns Array of file/directory paths in the current directory
()
| 690 | * @returns Array of file/directory paths in the current directory |
| 691 | */ |
| 692 | async function getTopLevelPaths(): Promise<string[]> { |
| 693 | const fs = getFsImplementation() |
| 694 | const cwd = getCwd() |
| 695 | |
| 696 | try { |
| 697 | const entries = await fs.readdir(cwd) |
| 698 | return entries.map(entry => { |
| 699 | const fullPath = path.join(cwd, entry.name) |
| 700 | const relativePath = path.relative(cwd, fullPath) |
| 701 | // Add trailing separator for directories |
| 702 | return entry.isDirectory() ? relativePath + path.sep : relativePath |
| 703 | }) |
| 704 | } catch (error) { |
| 705 | logError(error as Error) |
| 706 | return [] |
| 707 | } |
| 708 | } |
| 709 | |
| 710 | /** |
| 711 | * Generate file suggestions for the current input and cursor position |
no test coverage detected