Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find files in Visual Studio Code

I have an issue with Visual Studio Code (1.21) on Mac. When standing in a project that I work with, I can't find all the files using CMD + P, and the search is sketchy as well. The files only seems to be indexed if I have opened them before in VSC.

enter image description here

As you can see from this image, I have tried to find 'chapter.html', and in the folder on the left side you will see the file but VSC doesn't find it.

Anyone else experienced this and know what the issue might be?

like image 333
yarism Avatar asked Apr 13 '18 08:04

yarism


2 Answers

I had the same problem until I read https://github.com/Microsoft/vscode/issues/39440. The key is VSCode use .gitignore file to filter search result by default.

I guess you have .gitignore or .ignore file in your folder and you enable "search.useIgnoreFiles": true, and this is why you can't find file through CMD+P.

You could try to delete .gitignore(.ignore) file or set "search.useIgnoreFiles": false to disable it. Then CMD+P should work normally as you want.

like image 196
Asurada Avatar answered Oct 17 '22 05:10

Asurada


Pivoting off of what @asurada said, now (Version: 1.68) you can change this setting with the settings GUI.

Again, the key here is that by default VSCode uses .gitignore and .ignore to filter search results.

To change this default behavior using the settings GUI:


On Mac: Code > Preferences > Settings (or just Cmd+,)

  1. In the search bar type "gitignore search".

  2. Uncheck "Search: Use Ignore Files". (You may also need to uncheck "Search: Use Global Ignore Files" and "Search: Use Parent Ignore Files".)


Note: this is particularly useful for dbt users. After making this change, you can now easily search for compiled files.

like image 32
GuyStalks Avatar answered Oct 17 '22 07:10

GuyStalks