private void AddFixToResult(FlexMatch flexMatch, SimpleFix simpleFix, Result result) { result.Fixes ??= new List <Fix>(); string replacementText = flexMatch.Value.String.Replace(simpleFix.Find, simpleFix.ReplaceWith); var fix = new Fix() { Description = new Message() { Text = simpleFix.Description }, ArtifactChanges = new List <ArtifactChange>(new[] { new ArtifactChange() { ArtifactLocation = result.Locations[0].PhysicalLocation.ArtifactLocation, Replacements = new List <Replacement>(new[] { new Replacement() { DeletedRegion = new Region() { CharOffset = flexMatch.Index, CharLength = flexMatch.Length, }, InsertedContent = new ArtifactContent() { Text = replacementText, }, }, }), }, }), }; result.Fixes.Add(fix); }
private void ExpandArguments(SimpleFix fix, Dictionary <string, string> argumentNameToValueMap) { fix.Find = ExpandArguments(fix.Find, argumentNameToValueMap); fix.ReplaceWith = ExpandArguments(fix.ReplaceWith, argumentNameToValueMap); fix.Description = ExpandArguments(fix.Description, argumentNameToValueMap); }