private void ApplyToAllResults(IQuickFix quickFix, IEnumerable <IInspectionResult> inspectionResults, IRewriteSession rewriteSession) { foreach (var inspectionResult in inspectionResults) { quickFix.Fix(inspectionResult, rewriteSession); } }
public void Fix(IQuickFix fix, IInspectionResult result) { if (!CanFix(fix, result)) { return; } fix.Fix(result); _state.RewriteAllModules(); _state.OnParseRequested(this); }
public void Fix(IQuickFix fix, IInspectionResult result) { if (!CanFix(fix, result)) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); fix.Fix(result, rewriteSession); Apply(rewriteSession); }
public void Fix(IQuickFix fix, IInspectionResult result) { if (!CanFix(fix, result)) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); try { fix.Fix(result, rewriteSession); } catch (RewriteFailedException) { _failureNotifier.NotifyQuickFixExecutionFailure(rewriteSession.Status); } Apply(rewriteSession); }
public void FixInModule(IQuickFix fix, QualifiedSelection selection, Type inspectionType, IEnumerable <IInspectionResult> results) { var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType && result.QualifiedSelection.QualifiedName == selection.QualifiedName).ToList(); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result); } if (filteredResults.Any()) { _state.RewriteAllModules(); _state.OnParseRequested(this); } }
public void FixAll(IQuickFix fix, Type inspectionType, IEnumerable <IInspectionResult> results) { var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType).ToArray(); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result); } if (filteredResults.Any()) { _state.RewriteAllModules(); _state.OnParseRequested(this); } }
public void FixInProcedure(IQuickFix fix, QualifiedMemberName?qualifiedMember, Type inspectionType, IEnumerable <IInspectionResult> results) { Debug.Assert(qualifiedMember.HasValue, "Null qualified member."); var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType && result.QualifiedMemberName == qualifiedMember).ToList(); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result); } if (filteredResults.Any()) { _state.RewriteAllModules(); _state.OnParseRequested(this); } }
public void FixAll(IQuickFix fix, Type inspectionType, IEnumerable <IInspectionResult> results) { var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType).ToArray(); if (!filteredResults.Any()) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result, rewriteSession); } Apply(rewriteSession); }
public void FixInProject(IQuickFix fix, QualifiedSelection selection, Type inspectionType, IEnumerable <IInspectionResult> results) { var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType && result.QualifiedSelection.QualifiedName.ProjectId == selection.QualifiedName.ProjectId).ToList(); if (!filteredResults.Any()) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result, rewriteSession); } Apply(rewriteSession); }
public void Fix(IQuickFix fix, IEnumerable <IInspectionResult> resultsToFix) { var results = resultsToFix.ToList(); if (!results.Any()) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); foreach (var result in results) { if (!CanFix(fix, result)) { continue; } fix.Fix(result, rewriteSession); } Apply(rewriteSession); }
public void FixInProcedure(IQuickFix fix, QualifiedMemberName?qualifiedMember, Type inspectionType, IEnumerable <IInspectionResult> results) { Debug.Assert(qualifiedMember.HasValue, "Null qualified member."); var filteredResults = results.Where(result => result.Inspection.GetType() == inspectionType && result.QualifiedMemberName == qualifiedMember).ToList(); if (!filteredResults.Any()) { return; } var rewriteSession = RewriteSession(fix.TargetCodeKind); foreach (var result in filteredResults) { if (!CanFix(fix, result)) { continue; } fix.Fix(result, rewriteSession); } Apply(rewriteSession); }
private void ApplyToFirstResult(IQuickFix quickFix, IEnumerable <IInspectionResult> inspectionResults, IRewriteSession rewriteSession) { var resultToFix = inspectionResults.First(); quickFix.Fix(resultToFix, rewriteSession); }