示例#1
0
        IList <ClassificationSpan> IClassifier.GetClassificationSpans(SnapshotSpan toClassifySpan)
        {
            List <ClassificationSpan> list = new List <ClassificationSpan>();

            if (_document.IsMassiveChangeInProgress)
            {
                return(list);
            }
            EnsureInitialized();
            ITextSnapshot snapshot = toClassifySpan.Snapshot;

            for (int i = GetFirstClassificationDataAfterOrAtPosition(toClassifySpan.Start, snapshot); i < _spansToClassify.Count; i++)
            {
                ClassificationData classificationData = _spansToClassify[i];
                SnapshotSpan       span = classificationData.TrackingSpan.GetSpan(snapshot);
                if (span.Start >= toClassifySpan.End)
                {
                    break;
                }
                Microsoft.VisualStudio.Text.Span span2 = Microsoft.VisualStudio.Text.Span.FromBounds(Math.Max(span.Start, toClassifySpan.Start), Math.Min(span.End, toClassifySpan.End));
                SnapshotSpan        arg_C4_0           = new SnapshotSpan(snapshot, span2);
                IClassificationType classificationType = classificationData.ClassificationType;
                ClassificationSpan  item = new ClassificationSpan(arg_C4_0, classificationType);
                list.Add(item);
            }
            return(list);
        }
示例#2
0
        Geometry GetMarkerGeometry(WpfHexViewLine line, VST.Span span, bool clipToViewport, Thickness padding, bool isLineGeometry)
        {
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }
            if (!lines.Contains(line))
            {
                throw new ArgumentException();
            }

            bool         createOutlinedPath = false;
            PathGeometry geo        = null;
            var          textBounds = line.GetNormalizedTextBounds(span);

            HexMarkerHelper.AddGeometries(hexView, textBounds, isLineGeometry, clipToViewport, padding, 0, ref geo, ref createOutlinedPath);
            if (createOutlinedPath)
            {
                geo = geo.GetOutlinedPathGeometry();
            }
            if (geo != null && geo.CanFreeze)
            {
                geo.Freeze();
            }
            return(geo);
        }
示例#3
0
		public HexBufferLineImpl(HexBufferLineFormatter hexBufferLineFormatter, HexPosition lineNumber, ReadOnlyCollection<HexColumnType> columnOrder, HexBufferSpan bufferSpan, HexBytes hexBytes, string text, bool isOffsetColumnPresent, bool isValuesColumnPresent, bool isAsciiColumnPresent, HexPosition logicalOffset, HexCellCollection valueCells, HexCellCollection asciiCells, VST.Span offsetSpan, VST.Span fullValuesSpan, VST.Span visibleValuesSpan, VST.Span fullAsciiSpan, VST.Span visibleAsciiSpan) {
			if (hexBufferLineFormatter == null)
				throw new ArgumentNullException(nameof(hexBufferLineFormatter));
			if (columnOrder == null)
				throw new ArgumentNullException(nameof(columnOrder));
			if (bufferSpan.IsDefault)
				throw new ArgumentException();
			if (hexBytes.IsDefault)
				throw new ArgumentException();
			if (text == null)
				throw new ArgumentNullException(nameof(text));
			if (valueCells.IsDefault)
				throw new ArgumentNullException(nameof(valueCells));
			if (asciiCells.IsDefault)
				throw new ArgumentNullException(nameof(asciiCells));
			LineProvider = hexBufferLineFormatter;
			LineNumber = lineNumber;
			ColumnOrder = columnOrder;
			BufferSpan = bufferSpan;
			HexBytes = hexBytes;
			Text = text;
			IsOffsetColumnPresent = isOffsetColumnPresent;
			IsValuesColumnPresent = isValuesColumnPresent;
			IsAsciiColumnPresent = isAsciiColumnPresent;
			LogicalOffset = logicalOffset;
			ValueCells = valueCells;
			AsciiCells = asciiCells;
			this.offsetSpan = offsetSpan;
			this.fullValuesSpan = fullValuesSpan;
			this.visibleValuesSpan = visibleValuesSpan;
			this.fullAsciiSpan = fullAsciiSpan;
			this.visibleAsciiSpan = visibleAsciiSpan;
		}
示例#4
0
        protected override void Run()
        {
            var document = IdeApp.Workbench.ActiveDocument;

            if (!StylerOptionsConfiguration.IsFormatableDocument(document))
            {
                return;
            }

            var stylerOptions = StylerOptionsConfiguration.GetOptionsForDocument(document.FileName, document.Owner as Project);
            var styler        = new StylerService(stylerOptions);

            if (document.Editor is null)
            {
                var textBuffer      = document.TextBuffer;
                var currentSnapshot = textBuffer.CurrentSnapshot;
                var rawText         = currentSnapshot.GetText();
                var styledText      = styler.StyleDocument(rawText);
                var replaceSpan     = new Span(0, rawText.Length);
                textBuffer.Replace(replaceSpan, styledText);
            }
            else
            {
                var editor = document.Editor;
                using (editor.OpenUndoGroup())
                {
                    var styledText = styler.StyleDocument(editor.Text);
                    editor.Text = styledText;
                }
            }

            document.IsDirty = true;
        }
示例#5
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList <object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            IQuickInfoManager quickInfoManager;

            if (!session.Properties.TryGetProperty(typeof(IQuickInfoManager), out quickInfoManager))
            {
                return;
            }

            var model           = quickInfoManager.Model;
            var textSpan        = model.Span;
            var span            = new Span(textSpan.Start, textSpan.Length);
            var currentSnapshot = session.TextView.TextBuffer.CurrentSnapshot;
            var content         = GetContent(model);

            if (content == null)
            {
                return;
            }

            applicableToSpan = currentSnapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeNegative);
            quickInfoContent.Add(content);
        }
示例#6
0
        VSTF.TextBounds?TryGetNormalizedTextBounds(VST.Span lineSpan)
        {
            if (!IsValid)
            {
                throw new ObjectDisposedException(nameof(HexFormattedLineImpl));
            }
            var span = lineExtent.Intersection(lineSpan);

            if (span is null)
            {
                return(null);
            }

            var startBounds = GetFirstTextBounds(span.Value.Start);
            var endBounds   = GetLastTextBounds(span.Value.End);

            if (span.Value.End > TextSpan.End)
            {
                endBounds = new VSTF.TextBounds(
                    endBounds.Trailing + EndOfLineWidth,
                    endBounds.Top,
                    0,
                    endBounds.Height,
                    endBounds.TextTop,
                    endBounds.TextHeight);
            }

            return(new VSTF.TextBounds(startBounds.Left, startBounds.Top, endBounds.Left - startBounds.Left, startBounds.Height, startBounds.TextTop, startBounds.TextHeight));
        }
示例#7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="index">Cell index</param>
 /// <param name="groupIndex">Group index</param>
 /// <param name="bufferSpan">Buffer span or the default value if there's no data</param>
 /// <param name="textSpan">Span of the text. This span doesn't include any whitespace before and after the text.</param>
 /// <param name="cellSpan">Span of the cell, some of the span could be whitespace</param>
 /// <param name="separatorSpan">Span of the cell separator</param>
 /// <param name="fullSpan">Includes the whole cell and separator span</param>
 public HexCell(int index, int groupIndex, HexBufferSpan bufferSpan, VST.Span textSpan, VST.Span cellSpan, VST.Span separatorSpan, VST.Span fullSpan)
 {
     if (index < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(index));
     }
     if (groupIndex < 0 || groupIndex > 1)
     {
         throw new ArgumentOutOfRangeException(nameof(groupIndex));
     }
     if (cellSpan.Length == 0)
     {
         throw new ArgumentOutOfRangeException(nameof(cellSpan));
     }
     if (!fullSpan.Contains(cellSpan))
     {
         throw new ArgumentOutOfRangeException(nameof(cellSpan));
     }
     HasData       = !bufferSpan.IsDefault;
     Index         = index;
     GroupIndex    = groupIndex;
     BufferSpan    = bufferSpan;
     TextSpan      = textSpan;
     CellSpan      = cellSpan;
     SeparatorSpan = separatorSpan;
     FullSpan      = fullSpan;
 }
示例#8
0
        private void OnSpansChanged(object sender, SpansChangedEventArgs eventArgs)
        {
            IEnumerable <System.Web.Razor.Parser.SyntaxTree.Span> arg_8C_0 = eventArgs.Spans;

            Microsoft.VisualStudio.Text.Span?span = null;
            ITextSnapshot currentSnapshot         = _diskBuffer.CurrentSnapshot;

            if (_spansToClassify.Count > 0)
            {
                SnapshotPoint startPoint = _spansToClassify[0].TrackingSpan.GetStartPoint(currentSnapshot);
                SnapshotPoint endPoint   = _spansToClassify[_spansToClassify.Count - 1].TrackingSpan.GetEndPoint(currentSnapshot);
                span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(startPoint.Position, endPoint.Position));
            }
            _spansToClassify = new List <ClassificationData>();
            IClassificationType classificationType = null;

            foreach (System.Web.Razor.Parser.SyntaxTree.Span current in arg_8C_0)
            {
                switch (current.Kind)
                {
                case SpanKind.Transition:
                case SpanKind.MetaCode:
                    classificationType = _razorDelimiterClassificationType;
                    break;

                case SpanKind.Comment:
                    classificationType = _razorCommentClassificationType;
                    break;
                }
                if (classificationType != null)
                {
                    Microsoft.VisualStudio.Text.Span span2 = new Microsoft.VisualStudio.Text.Span(current.Start.AbsoluteIndex, current.Length);
                    ClassificationData item = new ClassificationData(currentSnapshot.CreateTrackingSpan(span2, SpanTrackingMode.EdgeExclusive), classificationType);
                    _spansToClassify.Add(item);
                    classificationType = null;
                }
            }
            if (_spansToClassify.Count > 0)
            {
                SnapshotPoint startPoint2 = _spansToClassify[0].TrackingSpan.GetStartPoint(currentSnapshot);
                SnapshotPoint endPoint2   = _spansToClassify[_spansToClassify.Count - 1].TrackingSpan.GetEndPoint(currentSnapshot);
                if (!span.HasValue)
                {
                    span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(startPoint2.Position, endPoint2.Position));
                }
                else
                {
                    span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(Math.Min(span.Value.Start, startPoint2.Position), Math.Max(span.Value.End, endPoint2.Position)));
                }
            }
            if (span.HasValue)
            {
                EventHandler <ClassificationChangedEventArgs> classificationChanged = ClassificationChanged;
                if (classificationChanged != null)
                {
                    SnapshotSpan changeSpan = new SnapshotSpan(currentSnapshot, span.Value);
                    classificationChanged(this, new ClassificationChangedEventArgs(changeSpan));
                }
            }
        }
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="line">Line info</param>
		/// <param name="lineSpan">Line span to classify</param>
		public HexClassificationContext(HexBufferLine line, VST.Span lineSpan) {
			if (line == null)
				throw new ArgumentNullException(nameof(line));
			if (!line.TextSpan.Contains(lineSpan))
				throw new ArgumentOutOfRangeException(nameof(lineSpan));
			Line = line;
			LineSpan = lineSpan;
		}
示例#10
0
		public HexLinePart(int index, int column, VST.Span span, HexAdornmentElement adornmentElement, TextRunProperties textRunProperties) {
			Debug.Assert(adornmentElement != null);
			Debug.Assert(textRunProperties != null);
			Index = index;
			Column = column;
			Span = span;
			AdornmentElement = adornmentElement;
			TextRunProperties = textRunProperties;
		}
示例#11
0
		public HexLinePart(int index, int column, VST.Span span, TextRunProperties textRunProperties) {
			Debug.Assert(!span.IsEmpty);
			Debug.Assert(textRunProperties != null);
			Index = index;
			Column = column;
			Span = span;
			AdornmentElement = null;
			TextRunProperties = textRunProperties;
		}
示例#12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="span"></param>
 /// <param name="tag"></param>
 public HexTextTagSpan(VST.Span span, T tag)
 {
     if (tag == null)
     {
         throw new ArgumentNullException(nameof(tag));
     }
     Span = span;
     Tag  = tag;
 }
示例#13
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="groupIndex">Group index</param>
		/// <param name="fullSpan">Full span including a possible separator at the end of the span</param>
		/// <param name="span">Span without the separator at the end of the span</param>
		public HexGroupInformation(int groupIndex, VST.Span fullSpan, VST.Span span) {
			if (groupIndex < 0 || groupIndex > 1)
				throw new ArgumentOutOfRangeException(nameof(groupIndex));
			if (!fullSpan.Contains(span))
				throw new ArgumentOutOfRangeException(nameof(span));
			GroupIndex = groupIndex;
			FullSpan = fullSpan;
			Span = span;
		}
示例#14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="span">Span</param>
 /// <param name="classification">Classification type</param>
 public HexClassificationSpan(VST.Span span, VSTC.IClassificationType classification)
 {
     if (classification == null)
     {
         throw new ArgumentNullException(nameof(classification));
     }
     Span = span;
     ClassificationType = classification;
 }
示例#15
0
 public HexLinePart(int index, int column, VST.Span span, HexAdornmentElement adornmentElement, TextRunProperties textRunProperties)
 {
     Debug.Assert(adornmentElement != null);
     Debug.Assert(textRunProperties != null);
     Index             = index;
     Column            = column;
     Span              = span;
     AdornmentElement  = adornmentElement;
     TextRunProperties = textRunProperties;
 }
示例#16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="line">Line</param>
 /// <param name="textSpan">Text span</param>
 public HexLineSpan(HexBufferLine line, VST.Span textSpan)
 {
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     BufferSpan     = line.BufferSpan;
     SelectionFlags = null;
     TextSpan       = textSpan;
 }
示例#17
0
        /// <summary>
        /// Do the two 'parts' match? i.e. Does the candidate part start with the pattern part?
        /// </summary>
        /// <param name="candidate">The candidate text</param>
        /// <param name="candidatePart">The span within the <paramref name="candidate"/> text</param>
        /// <param name="pattern">The pattern text</param>
        /// <param name="patternPart">The span within the <paramref name="pattern"/> text</param>
        /// <param name="compareOptions">Options for doing the comparison (case sensitive or not)</param>
        /// <returns>True if the span identified by <paramref name="candidatePart"/> within <paramref name="candidate"/> starts with
        /// the span identified by <paramref name="patternPart"/> within <paramref name="pattern"/>.</returns>
        private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, TextSpan patternPart, CompareOptions compareOptions)
        {
            if (patternPart.Length > candidatePart.Length)
            {
                // Pattern part is longer than the candidate part. There can never be a match.
                return(false);
            }

            return(_compareInfo.Compare(candidate, candidatePart.Start, patternPart.Length, pattern, patternPart.Start, patternPart.Length, compareOptions) == 0);
        }
示例#18
0
 public HexLinePart(int index, int column, VST.Span span, TextRunProperties textRunProperties)
 {
     Debug.Assert(!span.IsEmpty);
     Debug.Assert(textRunProperties != null);
     Index             = index;
     Column            = column;
     Span              = span;
     AdornmentElement  = null;
     TextRunProperties = textRunProperties;
 }
示例#19
0
        public override Collection <VSTF.TextBounds> GetNormalizedTextBounds(VST.Span lineSpan)
        {
            var list   = new List <VSTF.TextBounds>();
            var bounds = TryGetNormalizedTextBounds(lineSpan);

            if (!(bounds is null))
            {
                list.Add(bounds.Value);
            }
            return(new Collection <VSTF.TextBounds>(list));
        }
示例#20
0
 public override void EnsureSpanVisible(HexBufferLine line, VST.Span span, VSTE.EnsureSpanVisibleOptions options)
 {
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     if (line.Buffer != hexView.Buffer)
     {
         throw new ArgumentException();
     }
     EnsureSpanVisibleCore(new HexLineSpan(line, span), options);
 }
示例#21
0
        void WriteOffset(HexPosition logicalPosition, out VST.Span offsetSpan)
        {
            Debug.Assert(showOffset);
            int start = CurrentTextIndex;

            offsetFormatter.FormatOffset(stringBuilder, logicalPosition);
            offsetSpan = VST.Span.FromBounds(start, CurrentTextIndex);
            if (OffsetSpan != offsetSpan)
            {
                throw new InvalidOperationException();
            }
        }
示例#22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="line">Line info</param>
 /// <param name="lineSpan">Line span to classify</param>
 public HexClassificationContext(HexBufferLine line, VST.Span lineSpan)
 {
     if (line == null)
     {
         throw new ArgumentNullException(nameof(line));
     }
     if (!line.TextSpan.Contains(lineSpan))
     {
         throw new ArgumentOutOfRangeException(nameof(lineSpan));
     }
     Line     = line;
     LineSpan = lineSpan;
 }
示例#23
0
 public void Invoke(CancellationToken cancellationToken)
 {
     if (cancellationToken.IsCancellationRequested)
     {
         return;
     }
     foreach (var err in _replaceText)
     {
         Span          span         = new Span(err.Start, err.Length);
         ITrackingSpan trackingSpan = _span.TextBuffer.CurrentSnapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeInclusive);
         _span.TextBuffer.Replace(trackingSpan.GetSpan(_snapshot), err.ReplaceCode);
     }
 }
示例#24
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="groupIndex">Group index</param>
 /// <param name="fullSpan">Full span including a possible separator at the end of the span</param>
 /// <param name="span">Span without the separator at the end of the span</param>
 public HexGroupInformation(int groupIndex, VST.Span fullSpan, VST.Span span)
 {
     if (groupIndex < 0 || groupIndex > 1)
     {
         throw new ArgumentOutOfRangeException(nameof(groupIndex));
     }
     if (!fullSpan.Contains(span))
     {
         throw new ArgumentOutOfRangeException(nameof(span));
     }
     GroupIndex = groupIndex;
     FullSpan   = fullSpan;
     Span       = span;
 }
示例#25
0
		public HexLinePartsCollection(List<HexLinePart> lineParts, VST.Span lineSpan, string text) {
			if (lineParts == null)
				throw new ArgumentNullException(nameof(lineParts));
			if (text == null)
				throw new ArgumentNullException(nameof(text));
			Text = text;
			Span = lineSpan;
			LineParts = lineParts;
			if (lineParts.Count == 0)
				Length = 0;
			else {
				var last = lineParts[lineParts.Count - 1];
				Length = last.Column + last.ColumnLength;
			}
		}
示例#26
0
 public HexLinePartsCollection(List <HexLinePart> lineParts, VST.Span lineSpan, string text)
 {
     Text      = text ?? throw new ArgumentNullException(nameof(text));
     Span      = lineSpan;
     LineParts = lineParts ?? throw new ArgumentNullException(nameof(lineParts));
     if (lineParts.Count == 0)
     {
         Length = 0;
     }
     else
     {
         var last = lineParts[lineParts.Count - 1];
         Length = last.Column + last.ColumnLength;
     }
 }
示例#27
0
 public HexBufferLineImpl(HexBufferLineFormatter hexBufferLineFormatter, HexPosition lineNumber, ReadOnlyCollection <HexColumnType> columnOrder, HexBufferSpan bufferSpan, HexBytes hexBytes, string text, bool isOffsetColumnPresent, bool isValuesColumnPresent, bool isAsciiColumnPresent, HexPosition logicalOffset, HexCellCollection valueCells, HexCellCollection asciiCells, VST.Span offsetSpan, VST.Span fullValuesSpan, VST.Span visibleValuesSpan, VST.Span fullAsciiSpan, VST.Span visibleAsciiSpan)
 {
     if (hexBufferLineFormatter == null)
     {
         throw new ArgumentNullException(nameof(hexBufferLineFormatter));
     }
     if (columnOrder == null)
     {
         throw new ArgumentNullException(nameof(columnOrder));
     }
     if (bufferSpan.IsDefault)
     {
         throw new ArgumentException();
     }
     if (hexBytes.IsDefault)
     {
         throw new ArgumentException();
     }
     if (text == null)
     {
         throw new ArgumentNullException(nameof(text));
     }
     if (valueCells.IsDefault)
     {
         throw new ArgumentNullException(nameof(valueCells));
     }
     if (asciiCells.IsDefault)
     {
         throw new ArgumentNullException(nameof(asciiCells));
     }
     LineProvider           = hexBufferLineFormatter;
     LineNumber             = lineNumber;
     ColumnOrder            = columnOrder;
     BufferSpan             = bufferSpan;
     HexBytes               = hexBytes;
     Text                   = text;
     IsOffsetColumnPresent  = isOffsetColumnPresent;
     IsValuesColumnPresent  = isValuesColumnPresent;
     IsAsciiColumnPresent   = isAsciiColumnPresent;
     LogicalOffset          = logicalOffset;
     ValueCells             = valueCells;
     AsciiCells             = asciiCells;
     this.offsetSpan        = offsetSpan;
     this.fullValuesSpan    = fullValuesSpan;
     this.visibleValuesSpan = visibleValuesSpan;
     this.fullAsciiSpan     = fullAsciiSpan;
     this.visibleAsciiSpan  = visibleAsciiSpan;
 }
示例#28
0
        void CalculateValuesGroupSpans(List <HexGroupInformation> list)
        {
            list.Clear();
            if (!ShowValues)
            {
                return;
            }

            int  bytePos  = 0;
            int  pos      = 0;
            bool isGroup0 = true;

            while (bytePos < BytesPerLine)
            {
                int  groupByteEnd = bytePos + groupSizeInBytes;
                int  groupStart   = pos;
                bool needSep      = false;
                while (bytePos < BytesPerLine && bytePos < groupByteEnd)
                {
                    if (needSep)
                    {
                        pos++;
                    }
                    needSep = true;
                    pos    += valueFormatter.FormattedLength;
                    bytePos = bytePos + valueFormatter.ByteCount;
                }
                int      groupIndex = isGroup0 ? 0 : 1;
                var      span       = VST.Span.FromBounds(groupStart, pos);
                VST.Span fullSpan;
                if (bytePos < BytesPerLine)
                {
                    fullSpan = new VST.Span(span.Start, span.Length + 1);
                    pos++;
                }
                else
                {
                    fullSpan = span;
                }
                list.Add(new HexGroupInformation(groupIndex, fullSpan, span));
                isGroup0 = !isGroup0;
            }
            if (pos != ValuesSpan.Length)
            {
                throw new InvalidOperationException();
            }
        }
示例#29
0
        void UpdateLinkText(TextLink link, Microsoft.VisualStudio.Text.ITextEdit edit)
        {
            for (int i = 0; (i < link.Links.Count); ++i)
            {
                var s      = link.Links[i];
                int offset = s.Offset + baseOffset;
                if (offset < 0 || s.Length < 0 || offset + s.Length > Editor.Document.Length)
                {
                    // This should never happen since it implies a corrupted link/bad update following a text change.
                    continue;
                }

                var span = new Microsoft.VisualStudio.Text.Span(offset, s.Length);
                if (edit.Snapshot.GetText(span) != link.CurrentText)
                {
                    edit.Replace(span, link.CurrentText);
                }
            }
        }
示例#30
0
        public void AugmentQuickInfoSession(IQuickInfoSession session, IList<object> quickInfoContent, out ITrackingSpan applicableToSpan)
        {
            applicableToSpan = null;

            QuickInfoManager quickInfoManager;
            if (!session.Properties.TryGetProperty(typeof(QuickInfoManager), out quickInfoManager))
                return;

            var model = quickInfoManager.Model;
            var textSpan = model.Span;
            var span = new Span(textSpan.Start, textSpan.Length);
            var currentSnapshot = session.TextView.TextBuffer.CurrentSnapshot;
            var content = GetContent(model);
            if (content == null)
                return;

            applicableToSpan = currentSnapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeNegative);
            quickInfoContent.Add(content);
        }
示例#31
0
        void Add(List <HexLinePart> list, int column, HexClassificationSpan cspan, VST.Span lineExtent)
        {
            if (cspan.Span.Length == 0)
            {
                return;
            }
            int startOffs = lineExtent.Start;
            var props     = classificationFormatMap.GetTextProperties(cspan.ClassificationType);

            if (list.Count > 0)
            {
                var last = list[list.Count - 1];
                if (last.AdornmentElement == null && last.TextRunProperties == props && last.Span.End == cspan.Span.Start)
                {
                    list[list.Count - 1] = new HexLinePart(list.Count - 1, last.Column, VST.Span.FromBounds(last.Span.Start - startOffs, cspan.Span.End - startOffs), last.TextRunProperties);
                    return;
                }
            }
            list.Add(new HexLinePart(list.Count, column, new VST.Span(cspan.Span.Start - startOffs, cspan.Span.Length), props));
        }
示例#32
0
        public IEnumerable <ITagSpan <DaxTokenTag> > GetTags(NormalizedSnapshotSpanCollection spans)
        {
            foreach (var span in spans)
            {
                var line    = span.Start.GetContainingLine();
                var scanner = new TokenScanner(
                    line.GetText(),
                    line.Start.Position,
                    t => t.Token == Tokens.LEX_WHITE
                    );

                foreach (var location in scanner)
                {
                    var textSpan  = new Microsoft.VisualStudio.Text.Span(location.Location, location.Length);
                    var tokenSpan = new SnapshotSpan(span.Snapshot, textSpan);
                    if (tokenSpan.IntersectsWith(span))
                    {
                        yield return(new TagSpan <DaxTokenTag>(tokenSpan, new DaxTokenTag(TokenToTypeConverter.Convert(location.Token))));
                    }
                }
            }
        }
示例#33
0
        /// <summary>
        /// Get misspelled words in the given set of spans
        /// </summary>
        /// <param name="spans">The spans to check</param>
        /// <returns>An enumerable list of misspelling tags</returns>
        private IEnumerable <MisspellingTag> GetMisspellingsInSpans(NormalizedSnapshotSpanCollection spans)
        {
            List <Match>   rangeExclusions = new List <Match>();
            IList <string> spellingAlternates;
            SnapshotSpan   errorSpan, deleteWordSpan;

            Microsoft.VisualStudio.Text.Span lastWord;
            string textToSplit, actualWord, textToCheck, preferredTerm;
            int    mnemonicPos;
            var    ignoredWords = wordsIgnoredOnce;

            // **************************************************************************************************
            // NOTE: If anything changes here, update the related solution/project spell checking code in
            // ToolWindows\SolutionProjectSpellCheckControl.xaml.cs\GetMisspellingsInSpans().
            // **************************************************************************************************
            foreach (var span in spans)
            {
                textToSplit = span.GetText();

                rangeExclusions.Clear();

                // Note the location of all XML elements if needed
                if (configuration.IgnoreXmlElementsInText)
                {
                    rangeExclusions.AddRange(WordSplitter.XmlElement.Matches(textToSplit).Cast <Match>());
                }

                // Add exclusions from the configuration if any
                foreach (var exclude in configuration.ExclusionExpressions)
                {
                    try
                    {
                        rangeExclusions.AddRange(exclude.Matches(textToSplit).Cast <Match>());
                    }
                    catch (RegexMatchTimeoutException ex)
                    {
                        // Ignore expression timeouts
                        Debug.WriteLine(ex);
                    }
                }

                // Get any ignored words specified inline within the span
                foreach (Match m in reIgnoreSpelling.Matches(textToSplit))
                {
                    string ignored       = m.Groups["IgnoredWords"].Value;
                    bool   caseSensitive = !String.IsNullOrWhiteSpace(m.Groups["CaseSensitive"].Value);
                    int    start         = m.Groups["IgnoredWords"].Index;

                    foreach (var ignoreSpan in wordSplitter.GetWordsInText(ignored))
                    {
                        var ss = new SnapshotSpan(span.Snapshot, span.Start + start + ignoreSpan.Start,
                                                  ignoreSpan.Length);
                        var match = inlineIgnoredWords.FirstOrDefault(i => i.Span.GetSpan(span.Snapshot).IntersectsWith(ss));

                        if (match != null)
                        {
                            // If the span is already there, ignore it
                            if (match.Word == ss.GetText() && match.CaseSensitive == caseSensitive)
                            {
                                continue;
                            }

                            // If different, replace it
                            inlineIgnoredWords.Remove(match);
                        }

                        var ts = span.Snapshot.CreateTrackingSpan(ss, SpanTrackingMode.EdgeExclusive);

                        inlineIgnoredWords.Add(new InlineIgnoredWord
                        {
                            Word          = ignored.Substring(ignoreSpan.Start, ignoreSpan.Length),
                            CaseSensitive = caseSensitive,
                            Span          = ts,
                            IsNew         = true
                        });
                    }
                }

                lastWord = new Microsoft.VisualStudio.Text.Span();

                foreach (var word in wordSplitter.GetWordsInText(textToSplit))
                {
                    if (_isClosed)
                    {
                        yield break;
                    }

                    actualWord  = textToSplit.Substring(word.Start, word.Length);
                    mnemonicPos = actualWord.IndexOf(wordSplitter.Mnemonic);

                    if (mnemonicPos == -1)
                    {
                        textToCheck = actualWord;
                    }
                    else
                    {
                        textToCheck = actualWord.Substring(0, mnemonicPos) + actualWord.Substring(mnemonicPos + 1);
                    }

                    if (unescapeApostrophes && textToCheck.IndexOf("''", StringComparison.Ordinal) != -1)
                    {
                        textToCheck = textToCheck.Replace("''", "'");
                    }

                    if (inlineIgnoredWords.Any(w => w.IsMatch(textToCheck)))
                    {
                        continue;
                    }

                    // Spell check the word if it looks like one and is not ignored
                    if (wordSplitter.IsProbablyARealWord(textToCheck) && (rangeExclusions.Count == 0 ||
                                                                          !rangeExclusions.Any(match => word.Start >= match.Index &&
                                                                                               word.Start <= match.Index + match.Length - 1)))
                    {
                        errorSpan = new SnapshotSpan(span.Start + word.Start, word.Length);

                        // Check for a doubled word.  This isn't perfect as it won't detected doubled words
                        // across a line break.
                        if (configuration.DetectDoubledWords && lastWord.Length != 0 &&
                            textToSplit.Substring(lastWord.Start, lastWord.Length).Equals(actualWord,
                                                                                          StringComparison.OrdinalIgnoreCase) && String.IsNullOrWhiteSpace(textToSplit.Substring(
                                                                                                                                                               lastWord.Start + lastWord.Length, word.Start - lastWord.Start - lastWord.Length)))
                        {
                            // If the doubled word is not being ignored at the current location, return it
                            if (!ignoredWords.Any(w => w.StartPoint == errorSpan.Start && w.Word.Equals(actualWord,
                                                                                                        StringComparison.OrdinalIgnoreCase)))
                            {
                                // Delete the whitespace ahead of it too
                                deleteWordSpan = new SnapshotSpan(span.Start + lastWord.Start + lastWord.Length,
                                                                  word.Length + word.Start - lastWord.Start - lastWord.Length);

                                yield return(new MisspellingTag(errorSpan, deleteWordSpan));

                                lastWord = word;
                                continue;
                            }
                        }

                        lastWord = word;

                        // If the word is not being ignored, perform the other checks
                        if (!_dictionary.ShouldIgnoreWord(textToCheck) && !ignoredWords.Any(
                                w => w.StartPoint == errorSpan.Start && w.Word.Equals(actualWord,
                                                                                      StringComparison.OrdinalIgnoreCase)))
                        {
                            // Handle code analysis dictionary checks first as they may be not be recognized as
                            // correctly spelled words but have alternate handling.
                            if (configuration.CadOptions.TreatDeprecatedTermsAsMisspelled &&
                                configuration.DeprecatedTerms.TryGetValue(textToCheck, out preferredTerm))
                            {
                                yield return(new MisspellingTag(MisspellingType.DeprecatedTerm, errorSpan,
                                                                new[] { new SpellingSuggestion(null, preferredTerm) }));

                                continue;
                            }

                            if (configuration.CadOptions.TreatCompoundTermsAsMisspelled &&
                                configuration.CompoundTerms.TryGetValue(textToCheck, out preferredTerm))
                            {
                                yield return(new MisspellingTag(MisspellingType.CompoundTerm, errorSpan,
                                                                new[] { new SpellingSuggestion(null, preferredTerm) }));

                                continue;
                            }

                            if (configuration.CadOptions.TreatUnrecognizedWordsAsMisspelled &&
                                configuration.UnrecognizedWords.TryGetValue(textToCheck, out spellingAlternates))
                            {
                                yield return(new MisspellingTag(MisspellingType.UnrecognizedWord, errorSpan,
                                                                spellingAlternates.Select(a => new SpellingSuggestion(null, a))));

                                continue;
                            }

                            if (!_dictionary.IsSpelledCorrectly(textToCheck))
                            {
                                // Sometimes it flags a word as misspelled if it ends with "'s".  Try checking the
                                // word without the "'s".  If ignored or correct without it, don't flag it.  This
                                // appears to be caused by the definitions in the dictionary rather than Hunspell.
                                if (textToCheck.EndsWith("'s", StringComparison.OrdinalIgnoreCase) ||
                                    textToCheck.EndsWith("\u2019s", StringComparison.OrdinalIgnoreCase))
                                {
                                    string aposEss = textToCheck.Substring(textToCheck.Length - 2);

                                    textToCheck = textToCheck.Substring(0, textToCheck.Length - 2);

                                    if (_dictionary.ShouldIgnoreWord(textToCheck) ||
                                        _dictionary.IsSpelledCorrectly(textToCheck))
                                    {
                                        continue;
                                    }

                                    textToCheck += aposEss;
                                }

                                // Some dictionaries include a trailing period on certain words such as "etc." which
                                // we don't include.  If the word is followed by a period, try it with the period to
                                // see if we get a match.  If so, consider it valid.
                                if (word.Start + word.Length < textToSplit.Length && textToSplit[word.Start + word.Length] == '.')
                                {
                                    if (_dictionary.ShouldIgnoreWord(textToCheck + ".") ||
                                        _dictionary.IsSpelledCorrectly(textToCheck + "."))
                                    {
                                        continue;
                                    }
                                }

                                yield return(new MisspellingTag(errorSpan)
                                {
                                    EscapeApostrophes = unescapeApostrophes
                                });
                            }
                        }
                    }
                }
            }
        }
示例#34
0
		void CalculateValuesGroupSpans(List<HexGroupInformation> list) {
			list.Clear();
			if (!ShowValues)
				return;

			int bytePos = 0;
			int pos = 0;
			bool isGroup0 = true;
			while (bytePos < BytesPerLine) {
				int groupByteEnd = bytePos + groupSizeInBytes;
				int groupStart = pos;
				bool needSep = false;
				while (bytePos < BytesPerLine && bytePos < groupByteEnd) {
					if (needSep)
						pos++;
					needSep = true;
					pos += valueFormatter.FormattedLength;
					bytePos = bytePos + valueFormatter.ByteCount;
				}
				int groupIndex = isGroup0 ? 0 : 1;
				var span = VST.Span.FromBounds(groupStart, pos);
				VST.Span fullSpan;
				if (bytePos < BytesPerLine) {
					fullSpan = new VST.Span(span.Start, span.Length + 1);
					pos++;
				}
				else
					fullSpan = span;
				list.Add(new HexGroupInformation(groupIndex, fullSpan, span));
				isGroup0 = !isGroup0;
			}
			if (pos != ValuesSpan.Length)
				throw new InvalidOperationException();
		}
示例#35
0
 private void OnSpansChanged(object sender, SpansChangedEventArgs eventArgs)
 {
     IEnumerable<System.Web.Razor.Parser.SyntaxTree.Span> arg_8C_0 = eventArgs.Spans;
     Microsoft.VisualStudio.Text.Span? span = null;
     ITextSnapshot currentSnapshot = _diskBuffer.CurrentSnapshot;
     if (_spansToClassify.Count > 0)
     {
         SnapshotPoint startPoint = _spansToClassify[0].TrackingSpan.GetStartPoint(currentSnapshot);
         SnapshotPoint endPoint = _spansToClassify[_spansToClassify.Count - 1].TrackingSpan.GetEndPoint(currentSnapshot);
         span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(startPoint.Position, endPoint.Position));
     }
     _spansToClassify = new List<ClassificationData>();
     IClassificationType classificationType = null;
     foreach (System.Web.Razor.Parser.SyntaxTree.Span current in arg_8C_0)
     {
         switch (current.Kind)
         {
         case SpanKind.Transition:
         case SpanKind.MetaCode:
             classificationType = _razorDelimiterClassificationType;
             break;
         case SpanKind.Comment:
             classificationType = _razorCommentClassificationType;
             break;
         }
         if (classificationType != null)
         {
             Microsoft.VisualStudio.Text.Span span2 = new Microsoft.VisualStudio.Text.Span(current.Start.AbsoluteIndex, current.Length);
             ClassificationData item = new ClassificationData(currentSnapshot.CreateTrackingSpan(span2, SpanTrackingMode.EdgeExclusive), classificationType);
             _spansToClassify.Add(item);
             classificationType = null;
         }
     }
     if (_spansToClassify.Count > 0)
     {
         SnapshotPoint startPoint2 = _spansToClassify[0].TrackingSpan.GetStartPoint(currentSnapshot);
         SnapshotPoint endPoint2 = _spansToClassify[_spansToClassify.Count - 1].TrackingSpan.GetEndPoint(currentSnapshot);
         if (!span.HasValue)
         {
             span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(startPoint2.Position, endPoint2.Position));
         }
         else
         {
             span = new Microsoft.VisualStudio.Text.Span?(Microsoft.VisualStudio.Text.Span.FromBounds(Math.Min(span.Value.Start, startPoint2.Position), Math.Max(span.Value.End, endPoint2.Position)));
         }
     }
     if (span.HasValue)
     {
         EventHandler<ClassificationChangedEventArgs> classificationChanged = ClassificationChanged;
         if (classificationChanged != null)
         {
             SnapshotSpan changeSpan = new SnapshotSpan(currentSnapshot, span.Value);
             classificationChanged(this, new ClassificationChangedEventArgs(changeSpan));
         }
     }
 }
示例#36
0
		HexCell[] WriteValues(HexBytes hexBytes, HexSpan visibleBytesSpan, out VST.Span fullSpan, out VST.Span visibleSpan) {
			Debug.Assert(showValues);
			cellList.Clear();
			int fullStart = CurrentTextIndex;

			ulong cellCount = bytesPerLine / (ulong)valueFormatter.ByteCount;
			var flags = valuesLowerCaseHex ? HexValueFormatterFlags.LowerCaseHex : HexValueFormatterFlags.None;
			var pos = visibleBytesSpan.Start;
			var end = visibleBytesSpan.Start + bytesPerLine;
			int? visStart = null;
			int? visEnd = null;
			int cellPos = 0;
			for (ulong i = 0; i < cellCount; i++) {
				if (i != 0)
					stringBuilder.Append(' ');
				int groupIndex = (cellPos / groupSizeInBytes) & 1;

				HexBufferSpan bufferSpan;
				int cellStart = CurrentTextIndex;
				int spaces;
				if (visibleBytesSpan.Contains(pos)) {
					if (visStart == null)
						visStart = CurrentTextIndex;
					long valueIndex = (long)(pos - visibleBytesSpan.Start).ToUInt64();
					spaces = valueFormatter.FormatValue(stringBuilder, hexBytes, valueIndex, flags);
					var endPos = HexPosition.Min(endPosition, pos + (ulong)valueFormatter.ByteCount);
					bufferSpan = new HexBufferSpan(new HexBufferPoint(buffer, pos), new HexBufferPoint(buffer, endPos));
				}
				else {
					if (visStart != null && visEnd == null)
						visEnd = CurrentTextIndex;
					stringBuilder.Append(' ', valueFormatter.FormattedLength);
					spaces = valueFormatter.FormattedLength;
					bufferSpan = default(HexBufferSpan);
				}
				if (cellStart + valueFormatter.FormattedLength != CurrentTextIndex)
					throw new InvalidOperationException();
				var textSpan = VST.Span.FromBounds(cellStart + spaces, CurrentTextIndex);
				var cellSpan = VST.Span.FromBounds(cellStart, CurrentTextIndex);
				VST.Span separatorSpan;
				if (i + 1 < cellCount)
					separatorSpan = new VST.Span(CurrentTextIndex, 1);
				else
					separatorSpan = new VST.Span(CurrentTextIndex, 0);
				var cellFullSpan = VST.Span.FromBounds(cellStart, separatorSpan.End);
				cellList.Add(new HexCell((int)i, groupIndex, bufferSpan, textSpan, cellSpan, separatorSpan, cellFullSpan));

				pos += (ulong)valueFormatter.ByteCount;
				cellPos += valueFormatter.ByteCount;
			}
			if (pos != end)
				throw new InvalidOperationException();
			if (visStart != null && visEnd == null)
				visEnd = CurrentTextIndex;
			visibleSpan = visStart == null ? default(VST.Span) : VST.Span.FromBounds(visStart.Value, visEnd.Value);
			fullSpan = VST.Span.FromBounds(fullStart, CurrentTextIndex);
			if (ValuesSpan != fullSpan)
				throw new InvalidOperationException();
			return cellList.ToArray();
		}
示例#37
0
		void CalculateColumnSpans(out VST.Span offsetSpan, out VST.Span valuesSpan, out VST.Span asciiSpan) {
			offsetSpan = default(VST.Span);
			valuesSpan = default(VST.Span);
			asciiSpan = default(VST.Span);

			bool needSep = false;
			int position = 0;
			foreach (var column in columnOrder) {
				switch (column) {
				case HexColumnType.Offset:
					if (showOffset) {
						if (needSep)
							position++;
						needSep = true;
						offsetSpan = new VST.Span(position, offsetFormatter.FormattedLength);
						position = offsetSpan.End;
					}
					break;

				case HexColumnType.Values:
					if (showValues) {
						if (needSep)
							position++;
						needSep = true;
						int cellCount = (int)(bytesPerLine / (ulong)valueFormatter.ByteCount);
						valuesSpan = new VST.Span(position, valueFormatter.FormattedLength * cellCount + cellCount - 1);
						position = valuesSpan.End;
					}
					break;

				case HexColumnType.Ascii:
					if (showAscii) {
						if (needSep)
							position++;
						needSep = true;
						asciiSpan = new VST.Span(position, (int)bytesPerLine);
						position = asciiSpan.End;
					}
					break;

				default:
					throw new InvalidOperationException();
				}
			}
			if (position != CharsPerLine)
				throw new InvalidOperationException();
		}
示例#38
0
		internal bool SetTextAndMappings(List<RazorRange> newCodeRanges)
		{
			bool flag = false;
			EnsureLanguageProjectionBuffer();
			if (_languageProjectionBuffer == null)
			{
				return false;
			}
			IEnumerable<RazorRange> currentRanges = (_htmlDocument.ContentTypeHandler as IRazorContentTypeHandler).CurrentRanges;
			if (currentRanges.Count<RazorRange>() != newCodeRanges.Count)
			{
				flag = true;
			}
			else
			{
				int num = 0;
				foreach (RazorRange current in currentRanges)
				{
					RazorRange razorRange = newCodeRanges[num];
					if (razorRange.Start != current.Start || razorRange.Length != current.Length)
					{
						flag = true;
						break;
					}
					num++;
				}
			}
			if (!flag)
			{
				IProjectionBuffer iProjectionBuffer = _languageProjectionBuffer.IProjectionBuffer;
				string text = iProjectionBuffer.CurrentSnapshot.GetText();
				int matchingPrefixLen = StringUtility.GetMatchingPrefixLen(text, _code);
				if (matchingPrefixLen != _code.Length || _code.Length != text.Length)
				{
					int num2 = Whitespace.GetMatchingSuffixLen(text, _code);
					int num3 = Math.Min(text.Length, _code.Length);
					if (matchingPrefixLen + num2 > num3)
					{
						num2 = num3 - matchingPrefixLen;
					}
					int num4 = matchingPrefixLen + num2;
					int num5 = text.Length - num4;
					ReadOnlyCollection<SnapshotSpan> arg_14A_0 = iProjectionBuffer.CurrentSnapshot.GetSourceSpans();
					int num6 = 0;
					bool flag2 = false;
					foreach (SnapshotSpan current2 in arg_14A_0)
					{
						int num7 = num6 + current2.Length;
						if (num7 > matchingPrefixLen)
						{
							if (num6 < matchingPrefixLen && num7 > matchingPrefixLen + num5 && !current2.Snapshot.ContentType.IsOfType("htmlx"))
							{
								flag2 = true;
								break;
							}
							break;
						}
						else
						{
							num6 = num7;
						}
					}
					if (flag2)
					{
						Microsoft.VisualStudio.Text.Span replaceSpan = new Microsoft.VisualStudio.Text.Span(matchingPrefixLen, num5);
						string replaceWith = _code.Substring(matchingPrefixLen, _code.Length - num4);
						iProjectionBuffer.Replace(replaceSpan, replaceWith);
					}
					else
					{
						flag = true;
					}
				}
			}
			if (flag)
			{
				List<ProjectionMapping> mappings = GetMappings(newCodeRanges);
				mappings.Sort();
				_languageProjectionBuffer.SetTextAndMappings(_code, mappings.ToArray());
			}
			return flag;
		}
示例#39
0
		HexCell[] WriteAscii(HexBytes hexBytes, HexSpan visibleBytesSpan, out VST.Span fullSpan, out VST.Span visibleSpan) {
			Debug.Assert(showAscii);
			cellList.Clear();
			int fullStart = CurrentTextIndex;

			int? visStart = null;
			int? visEnd = null;
			var pos = visibleBytesSpan.Start;
			int cellPos = 0;
			for (ulong i = 0; i < bytesPerLine; i++, pos++) {
				int groupIndex = (cellPos / groupSizeInBytes) & 1;

				HexBufferSpan bufferSpan;
				int cellStart = CurrentTextIndex;
				if (visibleBytesSpan.Contains(pos)) {
					if (visStart == null)
						visStart = CurrentTextIndex;
					long index = (long)(pos - visibleBytesSpan.Start).ToUInt64();
					int b = hexBytes.TryReadByte(index);
					if (b < 0)
						stringBuilder.Append('?');
					else if (b < 0x20 || b > 0x7E)
						stringBuilder.Append('.');
					else
						stringBuilder.Append((char)b);
					bufferSpan = new HexBufferSpan(buffer, new HexSpan(pos, 1));
				}
				else {
					if (visStart != null && visEnd == null)
						visEnd = CurrentTextIndex;
					stringBuilder.Append(' ');
					bufferSpan = default(HexBufferSpan);
				}
				var cellSpan = VST.Span.FromBounds(cellStart, CurrentTextIndex);
				var separatorSpan = new VST.Span(cellSpan.End, 0);
				cellList.Add(new HexCell((int)i, groupIndex, bufferSpan, cellSpan, cellSpan, separatorSpan, cellSpan));

				cellPos++;
			}
			if ((ulong)fullStart + bytesPerLine != (ulong)CurrentTextIndex)
				throw new InvalidOperationException();
			if (visStart != null && visEnd == null)
				visEnd = CurrentTextIndex;
			visibleSpan = visStart == null ? default(VST.Span) : VST.Span.FromBounds(visStart.Value, visEnd.Value);
			fullSpan = VST.Span.FromBounds(fullStart, CurrentTextIndex);
			if (AsciiSpan != fullSpan)
				throw new InvalidOperationException();
			return cellList.ToArray();
		}
示例#40
0
        public static VSSpan ToVSSpan(this GLSLSpan span)
        {
            return(VSSpan.FromBounds(span.Start, span.End + 1));

            // return new VSSpan(span.Start, span.Length);
        }
示例#41
0
 public static GLSLSpan ToGLSLSpan(this VSSpan span)
 {
     return(GLSLSpan.Create(span.Start, span.End - 1));
 }
示例#42
0
 public HexSequenceElementImpl(VST.Span span)
 {
     Span = span;
 }
示例#43
0
 public AdornmentElementAndSpan(HexAdornmentElementImpl adornmentElement, VST.Span span)
 {
     AdornmentElement = adornmentElement;
     Span             = span;
 }
示例#44
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="index">Cell index</param>
		/// <param name="groupIndex">Group index</param>
		/// <param name="bufferSpan">Buffer span or the default value if there's no data</param>
		/// <param name="textSpan">Span of the text. This span doesn't include any whitespace before and after the text.</param>
		/// <param name="cellSpan">Span of the cell, some of the span could be whitespace</param>
		/// <param name="separatorSpan">Span of the cell separator</param>
		/// <param name="fullSpan">Includes the whole cell and separator span</param>
		public HexCell(int index, int groupIndex, HexBufferSpan bufferSpan, VST.Span textSpan, VST.Span cellSpan, VST.Span separatorSpan, VST.Span fullSpan) {
			if (index < 0)
				throw new ArgumentOutOfRangeException(nameof(index));
			if (groupIndex < 0 || groupIndex > 1)
				throw new ArgumentOutOfRangeException(nameof(groupIndex));
			if (cellSpan.Length == 0)
				throw new ArgumentOutOfRangeException(nameof(cellSpan));
			if (!fullSpan.Contains(cellSpan))
				throw new ArgumentOutOfRangeException(nameof(cellSpan));
			HasData = !bufferSpan.IsDefault;
			Index = index;
			GroupIndex = groupIndex;
			BufferSpan = bufferSpan;
			TextSpan = textSpan;
			CellSpan = cellSpan;
			SeparatorSpan = separatorSpan;
			FullSpan = fullSpan;
		}