Nx Workspace Focus
Focus VS Code on a subset of projects in a large Nx monorepo.
Features
- Discover Nx projects from
project.json and workspace.json files.
- Display discovered projects in an Explorer view as either a tree or a flat list.
- Select the projects you want to keep in focus and apply the selection to VS Code workspace settings.
- Filter projects by name or root path, with highlighted matches in the view.
- Apply Select All and Clear All actions to the current filtered result.
- Save and load named project selections as presets.
- Restrict the Explorer, Search, file watchers, and TypeScript server to the focused project set.
- Preserve user-managed workspace settings while updating only extension-managed entries.
Usage
This extension adds an Nx Focus view to the Explorer sidebar.
Open an Nx workspace and use the Nx Focus view to select the projects you want to keep visible and active. Click Apply to update the workspace configuration for the selected project set.
You can also run Nx Focus: Select Projects from the Command Palette to select projects and apply the focus configuration.
Focused workspace files
When a selection is applied, the extension updates the following files:
.vscode/settings.json
files.exclude
files.watcherExclude
js/ts.tsserver.watchOptions
nxWorkspaceFocus.projects
.vscode/tsconfig.focus.json
- A focused TypeScript project limited to the selected Nx projects.
.ignore
- A workspace-root ignore file used by ripgrep so Search excludes unfocused project roots without creating very long command-line arguments.
The extension never modifies nx.json, project.json, or build configuration files.
Search behavior
The extension deliberately keeps search.exclude empty and writes unfocused project roots to the workspace-root .ignore file instead.
This avoids ENAMETOOLONG command-line overflow errors on Windows in monorepos with many projects, because VS Code Search passes search.exclude patterns to ripgrep as command-line arguments.
Presets
Use Save Preset and Load Preset from the Nx Focus view to store and restore named project selections.
Presets are saved in .vscode/nx-focus-presets.json.
Screenshot
Below you can see the list of Nx projects in the currently opened workspace as they are displayed by this extension:

NX FOCUS:
- Switch between tree and flat project views.
- Filter projects by name or root path.
- Clear the active project filter.
- Show only selected projects or show all projects.
- Select all currently visible projects.
- Clear all currently visible projects.
- Apply the current project selection.
- Save the current selection as a preset.
- Load a saved preset.
- Refresh the project list.
Requirements
Open a workspace that contains an nx.json file.
Extension Settings
nxWorkspaceFocus.viewMode
- Display mode for Nx projects in the focus view (
tree or flat).
- Default:
flat
Known Issues
If .vscode/settings.json or a .code-workspace file contains syntax errors or schema warnings, VS Code can block the extension from writing workspace settings.
Open the workspace settings JSON file, fix the reported problems, save the file, and apply the focus selection again.
FAQ
- Why does the extension use
.ignore instead of search.exclude?
Large Nx workspaces can produce many excluded project roots. Writing those roots to .ignore lets ripgrep read them from a file and avoids very long Search command-line arguments, especially on Windows.
- Does the extension overwrite my existing workspace settings?
No. The extension updates only the entries it manages and preserves custom user-defined settings.
- Where are presets stored?
Presets are stored in .vscode/nx-focus-presets.json in the workspace.
Change Log
See Change Log here.
Issues
Submit an issue if you find any bug or have any request.
Contribution
Fork the repo and submit pull requests.