Vscode: files.exclude excluded files should NOT be excluded from quick find

Created on 27 Jan 2019  Â·  12Comments  Â·  Source: microsoft/vscode


  • VSCode Version: 1.30.2
  • OS Version: macOS 10.13.6

Steps to Reproduce:

  1. Set files.exclude to include the glob "*/.test.js"
  2. Try to load a file via Cmd-P - test files are now erroneously excluded from this as well. How else are we supposed to load them?


Does this issue occur when all extensions are disabled?: Yes

We colocate test files with their paired file, so foo.js and foo.test.js are in the same dir. This leads to a lot of test files that obscure the list of regular files. So we set files.exclude to include the glob **/*.test.js - great so tests are excluded from the file explorer. But now they are also not quick-loadable when I do Cmd-P and start typing out the name of the file.

This is not the optimal abstraction. Excluded test files should not be shown in the file explorer but SHOULD be shown when searching for them via Cmd-P. Otherwise, how else are we supposed to load them?

Thanks!

feature-request quick-pick search

All 12 comments

Excluded test files should not be shown in the file explorer but SHOULD be shown when searching for them via Cmd-P.

I don't really understand your position, the purpose of files.exclude is to hide files that are not part of your project. If you want to open/edit them regularly, they should be visible in the explorer and in quickopen.

Hey, @roblourens could you please not just close the issue this quickly? I'd like to see some discussion around this because it does impact a lot of people besides me. Would you consider re-opening it please, maybe as a feature request instead of as a bug? :-)

Let me try to explain my position to you:

  • I have a bunch of files in a directory like foo1.js,...,foo20.js
  • I colocate test files in the same directory alongside the actual code files. So foo1.test.js,...,foo20.test.js are in the same directory as foo1.js,...,foo20.js.
  • This leaves 40 files in the same directory and makes it difficult to spot the "real" files (the non-test files) amid the clutter of all the test files
  • I do need to be able to open the test files relatively easily from VSCode (e.g. via Cmd-P) but I do not want to see them in the file explorer because they are not as important as the non-test files
  • A lot of people scan the file explorer view to get a sense of the hierarchy of their project but do NOT want to see test files when doing that
  • The test files are absolutely a part of my project. I disagree that "the purpose of files.exclude is to hide files that are not part of your project" - I would argue that the purpose of files.exclude is to "hide files that you do not want to see in the file explorer"

Would you consider relabeling this from Bug to Feature Request and re-opening it so that we can have a discussion about this as I know that others are also interested in this feature?

Or maybe there is another way to hide foo.test.js from the file explorer but still make it openable from the quickopen? I'm open to other approaches.

Thanks!

@roblourens the actual documentation for files.exclude in VSCode itself says:

Configure glob patterns for excluding files and folders.
For example, the files explorer decides which files and folders to
show or hide based on this setting.

It doesn't say anything about "hide files that are not part of your project" it only talks about hiding or showing files without reference to whether they're "part of your project".

I think you're asking for a new setting for globs that would hide files from the file explorer but not from quickopen. I can leave it open but this doesn't really fit my idea of how the explorer/quickopen are used. If I were you, and if this is causing a lot of confusion, I would just put the tests in a separate folder :)

Since this seems to be the unclosed version of this feature request, I would like to ask if a pull request addressing this might be approved. It would be my first issue but it seems doable.

Proposal

Add an explorer.hidden setting with a similar interface to files.exclude but solely affecting the explorer. Files/globs could be set to true or false just as in the current files.exclude. By default, any file in files.exclude will also be hidden, so current users will see no change, but this could be overwritten by using files.exclude = true and explorer.hidden = false.

Documentation would be updated to clarify that files.exclude is intended for files that are not really part of the project at all such as .git while explorer.hidden is solely to affect appearance.

Potential addition

Perhaps instead of true/false settings, explorer.hidden could have the option visible, invisible, grayOut as in #19347 so that users could choose to manually gray out files that are not in .gitignore

Justification

  • There have been many related feature requests , often beginning as bugs. This seems to imply that the current behavior is confusing.
  • There are a variety of answers and questions on Stack Overflow pointing to files.exclude as "how you hide files" without any mention of other outcomes
  • There are several extensions designed to more easily "hide" and "unhide" files, again with no mention of other effects of files.exclude

I don't want to take this as a PR right now. I'll leave it open for discussion but I feel like a setting like this could just cause more confusion. I already get lots of issues from people who are confused about the effects of files.exclude, search.exclude, and .gitignore. Not looking forward to answering questions from more people who wouldn't understand why a file shows up in one place but not another.

And I don't understand how someone is supposed to navigate a codebase that has this configured. Do you have the whole file tree in your head so you know exactly what to type in quick open? I think you would confuse people looking at your codebase for the first time.

At the very least I think the documentation for files.exclude needs to be edited to make it clear that it does WAY more than simply hide files in the explorer. That is currently the only mentioned effect in the documentation, and there are many articles, answers, and even extensions (I use the Make Hidden extension by @Devine-Davies but there are others) that refer to this feature as exclusively one for hiding files; thus this bug report, and mine, and the many others that have been listed as duplicates.

Get Outlook for iOShttps://aka.ms/o0ukef


From: David Griswold notifications@github.com
Sent: Friday, September 20, 2019 5:28 pm
To: microsoft/vscode
Cc: Subscribed
Subject: Re: [microsoft/vscode] files.exclude excluded files should NOT be excluded from quick find (#67168)

At the very least I think the documentation for files.exclude needs to be edited to make it clear that it does WAY more than simply hide files in the explorer. That is currently the only mentioned effect in the documentation, and there are many articles, answers, and even extensions (I use the Make Hiddenhttps://github.com/Devine-Davies/vs-make-hidden extension by @Devine-Davieshttps://github.com/Devine-Davies but there are others) that refer to this feature as exclusively one for hiding files; thus this bug report, and mine, and the many others that have been listed as duplicates.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode/issues/67168?email_source=notifications&email_token=AMBW6JGC5ETMPUBQ5V6ANUDQKT23HA5CNFSM4GSR5AN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7HG6BQ#issuecomment-533622534, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMBW6JDGT4U6L6U3EKSZ6DTQKT23HANCNFSM4GSR5ANQ.

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Was this page helpful?
0 / 5 - 0 ratings