Skip to content

Support Windows paths and directory separators in path tab completion - #1212

Open
nordicnode wants to merge 1 commit into
CodebuffAI:mainfrom
nordicnode:fix-windows-path-tab-completion
Open

Support Windows paths and directory separators in path tab completion#1212
nordicnode wants to merge 1 commit into
CodebuffAI:mainfrom
nordicnode:fix-windows-path-tab-completion

Conversation

@nordicnode

Copy link
Copy Markdown

Support Windows paths and directory separators in path tab completion

Summary

• In cli/src/hooks/use-path-tab-completion.ts, fix path tab completion and automatic directory navigation on Windows.
• Previously, usePathTabCompletion checked searchQuery.startsWith('/') || searchQuery.startsWith('~') for absolute paths. On Windows, drive paths (C:\...) and UNC paths were not matched, causing them to fall through to the relative path branch (path.join(currentPath, searchQuery)).
• Furthermore, completed.endsWith('/') was used to detect full directory completions. On Windows, path-completion.ts appends path.sep (\), so completed.endsWith('/') was always false, breaking automatic directory navigation when pressing Tab.
• Exports pure helpers isAbsolutePath, isCompleteDirectory, and toRelativePath from use-path-tab-completion.ts to handle both POSIX and Windows path styles.
• In cli/src/hooks/__tests__/use-path-tab-completion.test.ts, uses the exported implementations and adds test cases for Windows drive paths and backslash directory completions.

Test plan

[✓] bun test --config=/dev/null src/hooks/__tests__/use-path-tab-completion.test.ts — 35 pass, 0 fail
[✓] bun run --cwd cli typecheck — 0 errors
[✓] PR hygiene check passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant