VS Code Tips
- 1. Introduction to VS Code
- 2. Command Palette & Navigation
- 3. Multi-Cursor & Advanced Editing
- 4. Workspace & Global Search
- 5. Keyboard Shortcuts Customization
- 6. Integrated Terminal Secrets
- 7. Custom Snippets & Emmet
- 8. Advanced Git Integration
- 9. Theme & Font Customizations
- 10. Essential Productivity Extensions
- 11. Debugging in VS Code
- 12. Task Automation (tasks.json)
- 13. Remote Development (SSH, Docker, WSL)
- 14. Profiles & Settings Sync
- 15. Best Practices & Speed Up
4. Workspace & Global Search
When working in standard, small projects, finding code is straightforward. However, inside massive monorepos or enterprise projects, code is distributed across hundreds of folders. VS Code contains a fast, multi-threaded **Global Search Engine** to track down variables or execute bulk updates.
Launching Global Search
Open the search sidebar pane instantly from your keyboard using the following shortcuts:
| Platform | Shortcut Key |
|---|---|
| Windows / Linux | Ctrl + Shift + F |
| macOS | Cmd + Shift + F |
Filtering Files (Files to Include/Exclude)
Often, search results are cluttered by build outputs (like node_modules, dist, or build directories). You can filter files by clicking the three dots (`...`) below the search fields:
- files to include: Enter search boundaries, e.g. typing
*.jslimits searches strictly to Javascript files, or typingsrc/components/restricts results to the components folder. - files to exclude: Enter exclusions, e.g. typing
**/test/**ignores all test files.
Advanced Search: Case Sensitivity & Regex
Make your searches extremely precise using the three toggle icons inside the search input bar:
- Match Case (Icon `Aa`): Limits results strictly to case-specific characters. (Shortcut: Alt + C / Option + C).
- Match Whole Word (Icon `[ab]`): Excludes words where your term is just a substring. E.g. searching for `port` will not return `transport` or `viewport`. (Shortcut: Alt + W).
- Use Regular Expression (Icon `.*`): Enables full regex search syntax! (Shortcut: Alt + R).
- Example: Searching for
const \w+Controllerfinds all controller variable declarations. - Example: Searching for
<h[1-6]>matches all HTML headings.
- Example: Searching for
Global Search and Replace
To rename a variable, class name, or update URLs across 50 different files at once, use **Global Replace**:
- Press Ctrl + Shift + H (Cmd + Shift + H on macOS) to open the search and replace input fields.
- Type your search query, then type the new replacement text in the second row.
- VS Code will display a visual diff panel for every file showing exactly what will change.
- Click the **Replace All** button next to the replacement bar (or press Ctrl + Alt + Enter / Cmd + Alt + Enter) to commit changes across all files instantly!
search.exclude, and add common build outputs or temporary log folders to the ignore list!