question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Find in Files "files to include" override .gitignore

See original GitHub issue

VSCode 1.12: I have a TypeScript project with a src folder and a .gitignore file containing this:

/src/**/*.js

If I search for something, it is OK with ‘files to include’ is empty:

image

but it is not OK if I scope the search:

image

While I’m searching only in some sup-tree of my project, all .gitignore rules should still be taken into account.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:52
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

12reactions
localjocommented, Apr 14, 2021

For anyone wondering about the status of this issue, it looks like the underlying ripgrep issue is a bit stale. In the meantime, I found a workaround that works for me to exclude irrelevant files from search in my multi-root workspace.

My workaround is adding this to my workspace settings.json:

  "search.exclude": {
    "**/.git": true,
    "**/node_modules": true,
    "**/tmp": true,
    "**/dist": true,
    "**/lib": true,
    "**/generated": true
  }

It’s not perfect, and doesn’t take into account any .gitignore files, but excluding those common patterns works well enough for me to find the files I’m looking for without sifting through loads of irrelevant results.

9reactions
EsrefDurnacommented, Jun 30, 2020

Could we prioritize this issue? Because it definitely blocks effective development. For example, I’m having an error from an module that I installed. I have to disable then enable ignore file search again and again. Evetytime I need to search on node modules folder its so annoying. And I believe most people though that the thing what they are searching doesn’t exists on node modules folder, which can lead to many hours of frustration and waste of time for each developer.

Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

.gitignore File – How to Ignore Files and Folders in Git
In this article, you will learn what a .gitignore file is, how to create one, and how to use it to ignore files...
Read more >
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and...
Read more >
vscode - how to get file search (not content) to include (git ...
Open visual studio code settings ( cmd + , on Mac or Ctrl + , ), search for the setting: Search: Use Ignore...
Read more >
How to Find and Create Git .gitignore File Templates
A Git ignore file is a text tile that sits inside your project directory, and tells Git which files or directories it should...
Read more >
How to Use a .gitignore File - Pluralsight
A .gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found