-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for excluding search paths via globbing patterns #1161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sensible to me, I had forgotten there was a globber from ms extensions.
{ | ||
public class FileOptions | ||
{ | ||
public string[] ExcludeSearchPatterns { get; set; } = new[] { "**/node_modules/**/*", "**/bin/**/*", "**/obj/**/*" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add search inclusions? (in the future perhaps?
Kinda feels like it would be sort of similar to how we used to be able to do things with project.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about "**/.git/**/*"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a good one 👍
Going to merge tomorrow afternoon if there are no other objections |
One thing that might improve the usability of this feature is perhaps we should split the exclusion patterns into 2 separate properties that you can override and customize. The way inheritance rules in our hierarchical configuration work, is that you can override everything, but you completely negate the setup from the previous source.
The problem is, this overrides the default setup and
This is not the greatest experience.
Then, you'd only override
If this makes sense, I will push this change before we merge. |
@filipw I like the idea of having a system level setting, and a user setting. 🚲 🏠 should the user property by I tend to favor |
OK thanks. So based on the convo, I added This way you can inject your own excludes into |
@filipw: should we update the WIki page with this information? https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options |
yes - you are right! I'll do that 📚 |
This PR is intended to fix #896
It introduces a new
omnisharp.json
setting to control which paths OmniSharp should skip (paths can be explicit or use globbing patterns).Globbing is provided via
Microsoft.Extensions.FileSystemGlobbing
which we conveniently already referenced 😄By default the following set up is used:
So no files from
bin
,obj
ornode_modules
are discovered, at any level.The default setup can be overridden using a global or local
omnisharp.json
file.For example:
This should not find anything from a
build
folder relative to currently open OmniSharp and anycsproj
file directly insideTestFixtures
.The new service is used in place of the old
SearchOption.AllDirectories
scanning.