Path Navigator
Path Navigator is a VS Code extension for finding files and directories by their
workspace-relative paths.
Features
- Search all descendant files and directories using partial or fuzzy names.
- Press Tab to complete a directory and continue searching inside it.
- Open files as pinned editor tabs by default.
- Reveal and select directories in the built-in Explorer.
- Index empty directories as well as files.
- Keep the index updated when files or directories are created or deleted.
- Support multi-root, remote, and virtual workspaces through
workspace.fs.
Usage
- Run Path Navigator: Open File or Reveal Directory from the Command Palette.
- Alternatively press
Cmd+Alt+P on macOS or Ctrl+Alt+P on Windows/Linux.
- With an empty input, the picker shows the direct children of the current
directory. Type part of a name to search all descendants in the current scope.
Both
ab and bc can match a directory named abc.
- Press Tab to complete the active result. Completing
abc changes the input to
abc/ and shows only its immediate files and subdirectories.
- Continue typing and pressing Tab to navigate the path one level at a time.
- Press Enter on a file to open it, or on a directory to reveal it in Explorer.
Global search and directory navigation work together. Given
abc/bcd/cde/file.ts, typing fi or ile at the workspace root finds the file
immediately. After completing abc/ with Tab, the same search only returns
matches located somewhere inside abc/.
For example, the path abc/bcd/cde can be reached as follows:
ab → Tab → abc/
bc → Tab → abc/bcd/
cd → Tab → abc/bcd/cde
The refresh button in the picker rebuilds the path index. You can also run
Path Navigator: Refresh Path Index.
Replace Cmd+P
VS Code does not provide an API for adding directories to its built-in Cmd+P
results. To use Path Navigator in its place, add the following to your user
keybindings.json:
{
"key": "cmd+p",
"command": "pathNavigator.open"
}
Use ctrl+p on Windows or Linux. You may also bind the original Quick Open
command, workbench.action.quickOpen, to another shortcut.
Development
From the repository root, run:
npm install
npm run check --workspace extensions/path-navigator
npm test --workspace extensions/path-navigator
npm test
Press F5 in VS Code to launch an Extension Development Host.
Known limitation
Directory navigation uses VS Code's built-in revealInExplorer command. The
command is used by bundled VS Code extensions but is not part of the documented
public command API, so compatibility is tested on a best-effort basis.