chromium / vs-chromium

A Visual Studio extension containing a collection of tools to help contributing code to the Chromium project.
BSD 3-Clause "New" or "Revised" License
311 stars 90 forks source link

Add support for excluding filenames for searches #55

Closed rpaquay closed 4 years ago

rpaquay commented 4 years ago

There is already support for multiple file patterns in Code Search, e.g:

service_directory.cc;service_directory_client.cc

It would be nice to have the ability to allow excluding patterns, e.g.

service*.cc;-*test.cc

This would mean: include all files named service*.cc, except for the ones ending with test.cc

This also begs the question of the need for an escape character for "-"

randomascii commented 4 years ago

There may be no need for an escape character if it is only interpreted as negation when it is the first character.

rpaquay commented 4 years ago

@randomascii

Wondering what should be the behavior if user type -foo.bar (or a list of exclusions only). I see 3 options:

  1. The pattern means include nothing (implicit) and exclude "foo.bar". This implies an always empty result set.

  2. The pattern means include "-foo.bar" literally, i.e is a way to escape the "-" character

  3. The pattern means include everything except for files named -foo.bar. Basically, we add an implicit * when there are only exclusions.

Option 1 sounds silly. Option 2 is a weird way to escape the "-" character. I think option 3 is the most intuitive.

Thoughts?

randomascii commented 4 years ago

I'm not sure it matters to much. Option 1 isn't useful, but it is consistent and not harmful. Option 3 would be fine, and is probably better.

rpaquay commented 4 years ago

Fixed in (pre)release 0.9.32 (https://github.com/chromium/vs-chromium/releases/tag/v0.9.32)

randomascii commented 4 years ago

It works perfectly, and you were correct to go with option number 3. Thanks!