Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

File Filters affect "Find In..." #7149

Closed
marcelgerber opened this issue Mar 10, 2014 · 8 comments
Closed

File Filters affect "Find In..." #7149

marcelgerber opened this issue Mar 10, 2014 · 8 comments
Assignees
Milestone

Comments

@marcelgerber
Copy link
Contributor

  1. Open FindInFiles.js in the Brackets project (add it to the Working Files)
  2. Invoke the context menu on the Working Files entry and click Find in...
  3. Edit... the filter to contain src/search/FindInFiles.js
  4. Start searching for, for example, Initial

Result: No results
Expected: Imo in this case, where the scope is just a single file, the filters shouldn't be active

image

@peterflynn
Copy link
Member

That seems fair. For a subtree it's definitely still useful, but suppressing the filter for a single-file search makes sense to me.

@peterflynn peterflynn self-assigned this Mar 11, 2014
@peterflynn peterflynn added this to the Release #38 milestone Mar 11, 2014
@marcelgerber
Copy link
Contributor Author

In a file tree, a filter affecting the whole scope should still not be used.

@peterflynn
Copy link
Member

Well, there's only one filter you can edit right now. You might want a different filter when your search is specific to a certain subtree, just as you might want a different filter when you switch projects... but you can always edit the filter in that case. I don't think preemptively turning off all filtering abilities makes sense for subtree searches. Filtering is still very useful if the subtree is large.

By "affecting the whole scope" do you mean cases where the filter screens out every file in the selected subtree? We could give some sort of UI feedback in cases where 0 files pass the filter, so it's more clear what happened. (It actually might be useful in general to indicate how many or what percentage of the files in scope were searched vs. filtered out -- that's definitely a nice enhancement too).

@marcelgerber
Copy link
Contributor Author

I'd like to see that enhancement as well.

But here's an example on what I meant:
Imagine this filter:

src/thirdparty

or this:

src/thirdparty/smart-auto-complete-local

Now Find in... src/thirdparty/smart-auto-complete-local/spec - you'll get no results 'cause the whole scope is ignored.

@peterflynn
Copy link
Member

Reviewed - medium priority to me

peterflynn added a commit that referenced this issue Apr 3, 2014
* When search scope is a single file, skip exclusion filter entirely
* If exclusions filter results in 0 files to search, show a message to that
effect and leave search bar open so user can adjust filter
* When editing a filter, show how many files are still included out of the
total number of files in the current search scope

Also cleans up FindInFiles to centralize the filtering code more, and
simplify _doSearchInOneFile() & its call sites.
@peterflynn
Copy link
Member

@SAplayer The approach we decided on is threefold:

  • When search scope is a single file, disable filtering and don't even show UI for it in the Find in Files bar
  • When search scope + filter results in zero files to search, when you hit Enter we show a red error popup under the search field explaining this, and leave the search bar open so you can edit or remove the filter
  • While editing a filter, we show a tally of how many files are included vs. excluded within the currently chosen search scope

ingorichter added a commit that referenced this issue Apr 5, 2014
File exclusions usability improvements (bug #7149)
@njx
Copy link
Contributor

njx commented Apr 5, 2014

Closing as fixed - @SAplayer if you'd like to check it out in master, please let us know if you run into any issues.

@njx njx closed this as completed Apr 5, 2014
@marcelgerber
Copy link
Contributor Author

Works fine. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants