Skip to content
the poor coder

include node_modules from search vscode

Poor Man
Published
Reading time
2 min read
On this page

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.
Text

"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.
Text

{
  "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!

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC