You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varresult= matcher.Execute(...);foreach(var match in result.Files){
Console.WriteLine(match.Index);}
Alternative Designs
Another option could be to simply add a Pattern property, that would hold the original pattern. Not sure which one is best, since FilePatternMatch is a struct (in memory terms).
Risks
This is not a breaking change (it only extends the api), nor I'm aware of any performance regressions this could cause.
The text was updated successfully, but these errors were encountered:
varresult= matcher.Execute(...);foreach(var match in result.Files){
Console.WriteLine(match.Index);}
Alternative Designs
Another option could be to simply add a Pattern property, that would hold the original pattern. Not sure which one is best, since FilePatternMatch is a struct (in memory terms).
Risks
This is not a breaking change (it only extends the api), nor I'm aware of any performance regressions this could cause.
An Index wouldn't be very useful as Matcher doesn't expose the include patterns. Including the Pattern in FilePatternMatch makes more sense to me.
There's an open request for improving Globbing in .NET (#21362), I think this proposal should be considered as part of that effort.
Background and motivation
I need to know which include pattern actually matches the
FilePatternMatch
returnedmatcher.Execute
.I'm proposing to add an additional property,
Index
, to theFilePatternMatch
, that would be the index where that pattern was added.With this information, I'm able to know the original pattern.
API Proposal
API Usage
Alternative Designs
Another option could be to simply add a
Pattern
property, that would hold the original pattern. Not sure which one is best, sinceFilePatternMatch
is a struct (in memory terms).Risks
This is not a breaking change (it only extends the api), nor I'm aware of any performance regressions this could cause.
The text was updated successfully, but these errors were encountered: