public bool Delete(ITextRange range) { var snapshot = _textBuffer.CurrentSnapshot; var newSnapshot = _textBuffer.Delete(range.ToSpan()); return(newSnapshot.Version.VersionNumber > snapshot.Version.VersionNumber); }
public bool Replace(ITextRange range, string text) { var snapshot = _textBuffer.CurrentSnapshot; var newSnapshot = _textBuffer.Replace(range.ToSpan(), text); return(newSnapshot.Version.VersionNumber > snapshot.Version.VersionNumber); }
private static ITextRange GetParameterBlockRange(ITextSnapshot snapshot, ITextRange block) { var content = snapshot.GetText(block.ToSpan()); var range = content.GetScopeBlockRange(); range.Shift(block.Start); return(range); }
public override void Invoke() { var element = this.HtmlSmartTag.Element; var textBuffer = this.HtmlSmartTag.TextBuffer; ITextRange range = element.InnerRange; string text = textBuffer.CurrentSnapshot.GetText(range.Start, range.Length); IFileMinifier minifier = element.IsScriptBlock() ? (IFileMinifier) new JavaScriptFileMinifier() : new CssFileMinifier(); string result = minifier.MinifyString(text); using (WebEssentialsPackage.UndoContext((this.DisplayText))) textBuffer.Replace(range.ToSpan(), result); }
public static string GetText(this ITextRange range, ITextSnapshot snapshot) => snapshot.GetText(range.ToSpan());
public void Delete(ITextRange range) => _textBuffer.Delete(range.ToSpan());
public void Replace(ITextRange range, string text) => _textBuffer.Replace(range.ToSpan(), text);
public ITrackingTextRange CreateTrackingRange(ITextRange range) => new TrackingTextRange(_snapshot.CreateTrackingSpan(range.ToSpan(), SpanTrackingMode.EdgeInclusive));