Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code does not see existing file

Apparently VS Code does not list existing files in files dropdown (Ctrl + P command).

Here is what it shows:

enter image description here

As you can see, the file laravel-2019-09-26.log exists in the directory (left bottom), but not in the files dropdown. After I open this file from the Explorer tree, it starts showing in the dropdown.

Am I doing something wrong or does this happen for everyone? Or is this command supposed to show previously opened files only? If so, what is the way to quickly open any existing file in the workspace?

N.B: I have gone through this related question. No one has mentioned this problem, making me think that this might be specific to my machine.

Edit

For future readers, second answer provided by @michaelze is spot on. VS Code by default does not list files mentioned in .gitignore. You can change this setting by going to Settings panel (File > Preferences > Settings) and typing useIgnoreFiles. This will bring up two boolean settings named Use Global Ignore Files and Use Ignore Files. Turn off these two settings and all workspace files will start showing in the files dropdown. Works correctly as of version 1.38.1.

enter image description here

like image 830
dotNET Avatar asked Nov 01 '25 12:11

dotNET


1 Answers

As those files are .log files, I assume, they are maybe mentioned in the .gitignore file? Maybe this can help you? Visual Studio Code - Automatic exclude based on .gitignore

The list you are seing when pressing CTRL + P is called recently opened. When you open one of the files, it was recently open, so it shows up. The CTRL + P menu also has a files results section that lists actual search results from the files you have in your workspace. None of your .log files are showing up in this section (hence the section is not visible).

like image 153
michaelze Avatar answered Nov 03 '25 20:11

michaelze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!