2

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

dotNET
  • 33,414
  • 24
  • 162
  • 251

2 Answers2

2

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

michaelze
  • 61
  • 3
0

The laravel-2019-09-08.log file is also missing from the drop down. I was wondering if maybe the listing is capped to a certain number of files. Try to be more specific with your search. In my version of VSCode, I can search for files using multiple words. Maybe try searching for "laravel 26" to find the file you are looking for?

michaelze
  • 61
  • 3
  • No. I have already checked that. Typing `26` immediately clears the list. – dotNET Sep 26 '19 at 06:09
  • Interestingly, the other missing file you have mentioned has also never been opened in VS Code. – dotNET Sep 26 '19 at 06:11
  • Have you tried refreshing the workspace? The respective button should appear on the "LADO2" label when you hover the file explorer on the left. – michaelze Sep 26 '19 at 06:14
  • I just gave it a try. As I expected, that button refreshes the File Explorer tree only, not the files dropdown (Ctrl + P) list. – dotNET Sep 26 '19 at 07:54
  • As those files are .log files, I assume, they are maybe mentioned in the .gitignore file? Maybe this can help you? https://stackoverflow.com/questions/40452848/visual-studio-code-automatic-exclude-based-on-gitignore – michaelze Sep 26 '19 at 08:17
  • That doesn't explain it. Why do other log files show? Even the missing file starts showing after I open it from Files Explorer. – dotNET Sep 26 '19 at 09:10
  • 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). Have you tried the setting mentioned in the question I linked? – michaelze Sep 26 '19 at 10:16
  • Thank you. That was exactly the thing. If you could replace your answer with the comment, I'll be happy to accept it. – dotNET Sep 26 '19 at 10:42