include node_modules from search vscode

Include node_modules from search vscode

If you're a developer, you know the importance of node_modules in your code. It contains all the dependencies required for your project to run smoothly. However, sometimes it can be a hassle to search for a specific package in your node_modules folder. Luckily, there's a way to include it in your search in Visual Studio Code (VSCode).

Method 1: Using the Search Sidebar

The first method is through the search sidebar. This is the easiest way to include node_modules in your search. Simply follow the steps below:

  • Open VSCode and click on the search icon in the sidebar (or press Ctrl+Shift+F).
  • Click on the three dots on the top right corner of the search box and select "Open Preferences".
  • Select "Settings" and type "search.exclude" in the search bar.
  • Scroll down to find the "search.exclude" setting and click on "Edit in settings.json".
  • Add "**/node_modules" in the "search.exclude" object and save the file.
  • Now when you search for a term, it will include node_modules in your search.

"search.exclude": {
  "**/node_modules": true
}

Method 2: Using a Custom File Type

The second method is through a custom file type. This allows you to search specifically for files in your node_modules folder. Follow the steps below:

  • Open VSCode and click on the search icon in the sidebar (or press Ctrl+Shift+F).
  • Click on the "files to include" dropdown and select "Configure file types..."
  • Click on the "Add File Type" button and name it "Node Modules".
  • Add "**/node_modules/**" in the "Glob Pattern" field.
  • Save the file type and close the window.
  • Now when you search for a term, select "Node Modules" under the "files to include" dropdown.

{
  "files.exclude": {
    "**/*.js.map": true
  },
  "search.exclude": {
    "**/node_modules": true
  },
  "search.useIgnoreFiles": true,
  "search.quickOpen.includeSymbols": true,
  "files.watcherExclude": {
    "**/node_modules/": true
  },
  "files.associations": {
    "*.html": "html",
    "*.hbs": "html",
    "*.ejs": "html"
  },
  "files.trimTrailingWhitespace": true,
  "editor.cursorBlinking": "phase",
  "workbench.iconTheme": "material-icon-theme",
  "workbench.colorTheme": "Material Theme Darker High Contrast",
  "[json]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Both methods are incredibly useful for searching through your code, especially when dealing with node_modules. Try them out and see which one works best for you!

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe