Added support for excluding search paths via globbing patterns#1161
Added support for excluding search paths via globbing patterns#1161david-driscoll merged 12 commits intoOmniSharp:masterfrom
Conversation
david-driscoll
left a comment
There was a problem hiding this comment.
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.
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.
What about "**/.git/**/*"?
|
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.jsonsetting to control which paths OmniSharp should skip (paths can be explicit or use globbing patterns).Globbing is provided via
Microsoft.Extensions.FileSystemGlobbingwhich we conveniently already referenced 😄By default the following set up is used:
So no files from
bin,objornode_modulesare discovered, at any level.The default setup can be overridden using a global or local
omnisharp.jsonfile.For example:
This should not find anything from a
buildfolder relative to currently open OmniSharp and anycsprojfile directly insideTestFixtures.The new service is used in place of the old
SearchOption.AllDirectoriesscanning.