예제 #1
0
        public bool Delete(ITextRange range)
        {
            var snapshot    = _textBuffer.CurrentSnapshot;
            var newSnapshot = _textBuffer.Delete(range.ToSpan());

            return(newSnapshot.Version.VersionNumber > snapshot.Version.VersionNumber);
        }
예제 #2
0
        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);
        }
예제 #3
0
        private static ITextRange GetParameterBlockRange(ITextSnapshot snapshot, ITextRange block)
        {
            var content = snapshot.GetText(block.ToSpan());
            var range   = content.GetScopeBlockRange();

            range.Shift(block.Start);
            return(range);
        }
예제 #4
0
            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);
            }
예제 #5
0
 public static string GetText(this ITextRange range, ITextSnapshot snapshot) => snapshot.GetText(range.ToSpan());
예제 #6
0
 public void Delete(ITextRange range) => _textBuffer.Delete(range.ToSpan());
예제 #7
0
 public void Replace(ITextRange range, string text) => _textBuffer.Replace(range.ToSpan(), text);
예제 #8
0
 public ITrackingTextRange CreateTrackingRange(ITextRange range)
 => new TrackingTextRange(_snapshot.CreateTrackingSpan(range.ToSpan(), SpanTrackingMode.EdgeInclusive));