当前位置: 首页>>代码示例>>C#>>正文


C# TextContentChangedEventArgs类代码示例

本文整理汇总了C#中TextContentChangedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# TextContentChangedEventArgs类的具体用法?C# TextContentChangedEventArgs怎么用?C# TextContentChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextContentChangedEventArgs类属于命名空间,在下文中一共展示了TextContentChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTextBufferChange

        private GherkinTextBufferChange GetTextBufferChange(TextContentChangedEventArgs textContentChangedEventArgs)
        {
            Tracing.VisualStudioTracer.Assert(textContentChangedEventArgs.Changes.Count > 0, "There are no text changes");

            var startLine = int.MaxValue;
            var endLine = 0;
            var startPosition = int.MaxValue;
            var endPosition = 0;
            var lineCountDelta = 0;
            var positionDelta = 0;

            var beforeTextSnapshot = textContentChangedEventArgs.Before;
            var afterTextSnapshot = textContentChangedEventArgs.After;
            foreach (var change in textContentChangedEventArgs.Changes)
            {
                startLine = Math.Min(startLine, beforeTextSnapshot.GetLineNumberFromPosition(change.OldPosition));
                endLine = Math.Max(endLine, afterTextSnapshot.GetLineNumberFromPosition(change.NewEnd));

                startPosition = Math.Min(startPosition, change.OldPosition);
                endPosition = Math.Max(endPosition, change.NewEnd);
                lineCountDelta += change.LineCountDelta;
                positionDelta += change.Delta;
            }

            return new GherkinTextBufferChange(
                startLine == endLine ? GherkinTextBufferChangeType.SingleLine : GherkinTextBufferChangeType.MultiLine,
                startLine, endLine,
                startPosition, endPosition,
                lineCountDelta, positionDelta,
                afterTextSnapshot);
        }
开发者ID:ChrisEdwards,项目名称:SpecFlow,代码行数:31,代码来源:GherkinLanguageServiceFactory.cs

示例2: OnBeforeTextBufferChanged

        void OnBeforeTextBufferChanged(object sender, TextContentChangedEventArgs e)
        {
            foreach (var change in e.Changes)
            {
                var offset = change.NewLength - change.OldLength;

                if (change.OldEnd < _span.Start)
                {
                    _span = new Span(_span.Start + offset, _span.Length);
                }
                else if (change.OldPosition > _span.End)
                {
                }
                else if (change.OldPosition == _span.End && _span.Length == 0)
                {
                    _span = new Span(_span.Start, _span.Length + offset);
                }
                else if (_span.Contains(change.OldPosition) &&
                        (_span.Contains(change.OldEnd) || _span.End == change.OldEnd) &&
                        (_span.Contains(change.NewEnd) || _span.End == change.NewEnd))
                {
                    _span = new Span(_span.Start, _span.Length + offset);
                }
            }
        }
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:25,代码来源:TrackingSpanMock.cs

示例3: BufferChanged

 static void BufferChanged(object sender, TextContentChangedEventArgs e)
 {
     if (!Settings.Default.DisableAllParsing)
     {
         BufferChanged(sender);
     }
 }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:7,代码来源:BufferIdleEventUtil.cs

示例4: CombineChanges

        /// <summary>
        /// Combines multiple changes into one larger change.
        /// </summary>
        /// <param name="e">Text buffer change event argument</param>
        /// <param name="start">Combined span start</param>
        /// <param name="oldLength">Length of the change in the original buffer state</param>
        /// <param name="newLength">Length of the change in the new buffer state</param>
        internal static void CombineChanges(TextContentChangedEventArgs e, out int start, out int oldLength, out int newLength) {
            start = 0;
            oldLength = 0;
            newLength = 0;

            if (e.Changes.Count > 0) {
                // Combine multiple changes into one larger change. The problem is that
                // multiple changes map to one current snapshot and there are no
                // separate snapshots for each change which causes problems
                // in incremental parse analysis code.

                Debug.Assert(e.Changes[0].OldPosition == e.Changes[0].NewPosition);

                start = e.Changes[0].OldPosition;
                int oldEnd = e.Changes[0].OldEnd;
                int newEnd = e.Changes[0].NewEnd;

                for (int i = 1; i < e.Changes.Count; i++) {
                    start = Math.Min(start, e.Changes[i].OldPosition);
                    oldEnd = Math.Max(oldEnd, e.Changes[i].OldEnd);
                    newEnd = Math.Max(newEnd, e.Changes[i].NewEnd);
                }

                oldLength = oldEnd - start;
                newLength = newEnd - start;
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:34,代码来源:TextUtility.cs

示例5: TextBufferOnChanged

        private void TextBufferOnChanged(object sender, TextContentChangedEventArgs ea)
        {
            Func<int, DateTime, IEnumerable<DateTime>> fill = (count, time) => Enumerable.Range(0, count).Select(t => time);

            foreach (var textChange in ea.Changes)
            {
                var lineNumber = ea.Before.GetLineFromPosition(textChange.OldPosition).LineNumber;

                if (textChange.LineCountDelta > 0)
                {
                    var count =_lineTimeStamps.Count;
                    _lineTimeStamps.InsertRange(
                        Math.Min(lineNumber, count), 
                        fill(textChange.LineCountDelta + lineNumber - count, DateTime.Now));
                }
                else if (textChange.LineCountDelta < 0)
                {
                    try
                    {
                        _lineTimeStamps.RemoveRange(lineNumber, -textChange.LineCountDelta);
                    }
                    catch (ArgumentException)
                    {
                        _lineTimeStamps.Clear();
                    }
                }
            }
        }
开发者ID:kazu46,项目名称:VSColorOutput,代码行数:28,代码来源:TimeStampMargin.cs

示例6: NewBufferChanged

        private void NewBufferChanged(object sender, TextContentChangedEventArgs e)
        {
            bool isCommand = IsCommand(e.After.GetExtent());

            ITextBuffer buffer = e.After.TextBuffer;
            IContentType contentType = buffer.ContentType;
            IContentType newContentType = null;

            if (contentType == languageContentType)
            {
                if (isCommand)
                {
                    newContentType = commandContentType;
                }
            }
            else
            {
                if (!isCommand)
                {
                    newContentType = languageContentType;
                }
            }

            if (newContentType != null)
            {
                buffer.ChangeContentType(newContentType, editTag: null);
            }
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:28,代码来源:InteractiveWindowCommands.cs

示例7: OnBufferChanged

 private void OnBufferChanged(object sender, TextContentChangedEventArgs e)
 {
     foreach(ITextChange change in e.Changes)
     {
         _bufferChanges.Append(change.OldText);
     }
 }
开发者ID:ActualAdam,项目名称:EmacsKeys,代码行数:7,代码来源:BufferMonitor.cs

示例8: OnTextBufferChanged

 private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
 {
     lock (_lockObject)
     {
         _currentParseCancellationTokenSource?.Cancel();
         _hasWork.Set();
     }
 }
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:8,代码来源:BackgroundParser.cs

示例9: BufferChanged

        static void BufferChanged(object sender, TextContentChangedEventArgs e)
        {
            ITextBuffer buffer = sender as ITextBuffer;
            if (buffer == null)
                return;

            RestartTimerForBuffer(buffer);
        }
开发者ID:dbremner,项目名称:dafny,代码行数:8,代码来源:BufferIdleEventUtil.cs

示例10: RaiseChanged

 protected virtual void RaiseChanged(TextContentChangedEventArgs textChangedEventArgs = null)
 {
     var changed = this.Changed;
     if (changed != null)
     {
         changed(this, new TaggerEventArgs(EventKind, _delay, textChangedEventArgs));
     }
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:AbstractTaggerEventSource.cs

示例11: TextBuffer_Changed

 void TextBuffer_Changed(object sender, TextContentChangedEventArgs e)
 {
     if (e.After.LineCount != _ovlc.Count)
     {
         IsRedraw = true;
         this.ReGenOv(e.After);
     }
 }
开发者ID:mintberry,项目名称:stackrecaller,代码行数:8,代码来源:OvCollection.cs

示例12: Buffer_Changed

            private void Buffer_Changed(object sender, TextContentChangedEventArgs e)
            {
                AssertIsForeground();

                if (!_buffer.GetOption(InternalFeatureOnOffOptions.RenameTracking))
                {
                    // When disabled, ignore all text buffer changes and do not trigger retagging
                    return;
                }

                using (Logger.LogBlock(FunctionId.Rename_Tracking_BufferChanged, CancellationToken.None))
                {
                    // When the buffer changes, several things might be happening:
                    // 1. If a non-identifer character has been added or deleted, we stop tracking
                    //    completely.
                    // 2. Otherwise, if the changes are completely contained an existing session, then
                    //    continue that session.
                    // 3. Otherwise, we're starting a new tracking session. Find and track the span of
                    //    the relevant word in the foreground, and use a task to figure out whether the
                    //    original word was a renamable identifier or not.

                    if (e.Changes.Count != 1 || ShouldClearTrackingSession(e.Changes.Single()))
                    {
                        ClearTrackingSession();
                        return;
                    }

                    // The change is trackable. Figure out whether we should continue an existing
                    // session

                    var change = e.Changes.Single();

                    if (this.TrackingSession == null)
                    {
                        StartTrackingSession(e);
                        return;
                    }

                    // There's an existing session. Continue that session if the current change is
                    // contained inside the tracking span.

                    SnapshotSpan trackingSpanInNewSnapshot = this.TrackingSession.TrackingSpan.GetSpan(e.After);
                    if (trackingSpanInNewSnapshot.Contains(change.NewSpan))
                    {
                        // Continuing an existing tracking session. If there may have been a tag
                        // showing, then update the tags.
                        if (this.TrackingSession.IsDefinitelyRenamableIdentifier())
                        {
                            this.TrackingSession.CheckNewIdentifier(this, _buffer.CurrentSnapshot);
                            TrackingSessionUpdated();
                        }
                    }
                    else
                    {
                        StartTrackingSession(e);
                    }
                }
            }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:58,代码来源:RenameTrackingTaggerProvider.StateMachine.cs

示例13: TextBuffer_Changed

        void TextBuffer_Changed(object sender, TextContentChangedEventArgs e)
        {
            if (_processing)
                return;

            _typedChar = '\0';

            if (e.Changes.Count != 1 || e.AfterVersion.ReiteratedVersionNumber <= _bufferVersionWaterline)
                return;

            var change = e.Changes[0];

            _bufferVersionWaterline = e.AfterVersion.ReiteratedVersionNumber;

            // Change length may be > 1 in autoformatting languages.
            // However, there will be only one non-ws character in the change.
            // Be careful when </script> is inserted: the change won't
            // actually be in this buffer.

            var snapshot = _textBuffer.CurrentSnapshot;

            if (change.NewSpan.End > snapshot.Length)
                return;

            var text = _textBuffer.CurrentSnapshot.GetText(change.NewSpan);

            text = text.Trim();

            if (text.Length != 1)
                return;

            // Allow completion of different characters inside spans, but not when
            // character and its completion pair is the same. For example, we do
            // want to complete () in foo(bar|) when user types ( after bar. However,
            // we do not want to complete " when user is typing in a string which
            // was already completed and instead " should be a terminating type-through.

            var typedChar = text[0];
            var completionChar = GetCompletionCharacter(typedChar);

            var caretPosition = GetCaretPositionInBuffer();

            if (!caretPosition.HasValue)
                return;

            bool compatible = true;

            var innerText = GetInnerProvisionalText();

            if (innerText != null)
                compatible = IsCompatibleCharacter(innerText.ProvisionalChar, typedChar);

            if (IsPositionInProvisionalText(caretPosition.Value) && typedChar == completionChar && !compatible)
                return;

            _typedChar = typedChar;
            _caretPosition = caretPosition.Value;
        }
开发者ID:ChrisTorng,项目名称:WebEssentials2013,代码行数:58,代码来源:TypeThroughController.cs

示例14: TaggerEventArgs

 internal TaggerEventArgs(
     string kind,
     TaggerDelay delay,
     TextContentChangedEventArgs textChangeEventArgs = null)
 {
     this.Kind = kind;
     this.Delay = delay;
     this.TextChangeEventArgs = textChangeEventArgs;
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:9,代码来源:TaggerEventArgs.cs

示例15: OnTextBufferChanged

            private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
            {
                if (e.Changes.Count == 0)
                {
                    return;
                }

                this.RaiseChanged();
            }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:TaggerEventSources.TextChangedEventSource.cs


注:本文中的TextContentChangedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。