/// <summary> /// Substitutes all occurrences between the specified start and end points of the specified /// pattern string with the specified replacement string. /// </summary> /// <param name="startPoint">The start point.</param> /// <param name="endPoint">The end point.</param> /// <param name="patternString">The pattern string.</param> /// <param name="replacementString">The replacement string.</param> internal static void SubstituteAllStringMatches(EditPoint startPoint, EditPoint endPoint, string patternString, string replacementString) { UIThread.Run(() => { ThreadHelper.ThrowIfNotOnUIThread(); if (TryGetTextBufferAt(startPoint.Parent.Parent.FullName, out ITextBuffer textBuffer)) { IFinder finder = GetFinder(patternString, replacementString, textBuffer); ReplaceAll(textBuffer, finder.FindForReplaceAll(GetSnapshotSpanForExtent(textBuffer.CurrentSnapshot, startPoint, endPoint))); } }); }
/// <summary> /// Substitutes all occurrences in the specified text document of the specified pattern /// string with the specified replacement string. /// </summary> /// <param name="textDocument">The text document.</param> /// <param name="patternString">The pattern string.</param> /// <param name="replacementString">The replacement string.</param> internal static void SubstituteAllStringMatches(TextDocument textDocument, string patternString, string replacementString) { UIThread.Run(() => { ThreadHelper.ThrowIfNotOnUIThread(); if (TryGetTextBufferAt(textDocument.Parent.FullName, out ITextBuffer textBuffer)) { IFinder finder = GetFinder(patternString, replacementString, textBuffer); ReplaceAll(textBuffer, finder.FindForReplaceAll()); } }); }