Exemplo n.º 1
0
 public void TokenTagsChanged(object sender, TagsChangedEventArgs e)
 {
     foreach (var span in e.Span.GetSpans(_buffer))
     {
         TagsChanged(this, new SnapshotSpanEventArgs(span));
     }
 }
Exemplo n.º 2
0
        private void TokenTagsChanged(object sender, TagsChangedEventArgs e)
        {
            ITextBuffer  buffer = e.Span.BufferGraph.TopBuffer;
            SnapshotSpan span   = new(buffer.CurrentSnapshot, 0, buffer.CurrentSnapshot.Length);

            TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
        }
Exemplo n.º 3
0
        void _aggregator_TagsChanged(object sender, TagsChangedEventArgs e)
        {
            var r = sender as ResolverTagger;

            if (r != null)
            {
                ITextSnapshot           snap;
                Microsoft.Dafny.Program prog;
                lock (this) {
                    snap = r.Snapshot;
                    prog = r.Program;
                }
                if (prog != null)
                {
                    if (!ComputeIdentifierRegions(prog, snap))
                    {
                        return; // no new regions
                    }
                    var chng = TagsChanged;
                    if (chng != null)
                    {
                        NormalizedSnapshotSpanCollection spans = e.Span.GetSpans(_buffer.CurrentSnapshot);
                        if (spans.Count > 0)
                        {
                            SnapshotSpan span = new SnapshotSpan(spans[0].Start, spans[spans.Count - 1].End);
                            chng(this, new SnapshotSpanEventArgs(span));
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Обработчик события изменения набора тегов.
 /// </summary>
 /// <param name="sender">Отправитель.</param>
 /// <param name="e">Параметр события.</param>
 private void MisspellingTagsChanged(object sender, TagsChangedEventArgs e)
 {
     foreach (var span in e.Span.GetSpans(buffer))
     {
         RaiseTagsChangedEvent(span.TranslateTo(buffer.CurrentSnapshot, SpanTrackingMode.EdgeExclusive));
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Recheck the changed spans when tags change
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void AggregatorTagsChanged(object sender, TagsChangedEventArgs e)
 {
     if (!isClosed)
     {
         this.AddDirtySpans(e.Span.GetSpans(buffer.CurrentSnapshot));
     }
 }
Exemplo n.º 6
0
 void TagAggregator_TagsChanged(object sender, TagsChangedEventArgs e)
 {
     foreach (var span in e.Span.GetSpans(textBuffer))
     {
         TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
     }
 }
Exemplo n.º 7
0
        private void Ctl_Tags_OnTagsChanged(object sender, TagsChangedEventArgs e)
        {
            SelectionChanged.Content = e.Items.Aggregate("", (s, item) => $"{s} {item.Text}");
            Debug.WriteLine("TagsChanged: " + e.Items.Aggregate("", (s, item) => $"{s} {item.Text}"));
            var vm = DataContext as MainWindowViewModel;

            vm?.SelectedTagsChanged(e.Items);
        }
Exemplo n.º 8
0
 private void LanguageElementTagsChanged(object sender, TagsChangedEventArgs e)
 {
     if (this.enabled)
     {
         foreach (SnapshotSpan span in e.Span.GetSpans(this.textBuffer))
             UpdateAfterChange(span);
     }
 }
Exemplo n.º 9
0
        void OnTagsChanged(object sender, TagsChangedEventArgs e)
        {
            EventHandler <TagsChangedEventArgs> handler = this.MarksChanged;

            if (handler != null)
            {
                handler(sender, e);
            }
        }
Exemplo n.º 10
0
 void aggregator_TagsChanged(object sender, TagsChangedEventArgs e)
 {
     textView.VisualElement.Dispatcher.BeginInvoke(new Action(() =>
     {
         foreach (var span in e.Span.GetSpans(textView.TextSnapshot))
         {
             RefreshExtent(span);
         }
     }), DispatcherPriority.Normal);
 }
Exemplo n.º 11
0
        private void OnTagAggregatorTagsChanged(object sender, TagsChangedEventArgs e)
        {
            _cache.Clear();
            var spans = e.Span.GetSpans(_buffer);

            foreach (var span in spans)
            {
                TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(span));
            }
        }
 private void LanguageElementTagsChanged(object sender, TagsChangedEventArgs e)
 {
     if (this.enabled)
     {
         foreach (SnapshotSpan span in e.Span.GetSpans(this.textBuffer))
         {
             UpdateAfterChange(span);
         }
     }
 }
Exemplo n.º 13
0
 void TagAggregator_TagsChanged(object sender, TagsChangedEventArgs e)
 {
     if (wpfTextView.IsClosed)
     {
         return;
     }
     foreach (var span in e.Span.GetSpans(wpfTextView.TextBuffer.CurrentSnapshot))
     {
         tagger?.RefreshSpans(new SnapshotSpanEventArgs(span));
     }
 }
 void OnTagsChanged(object sender, TagsChangedEventArgs e)
 {
     if (this.IsVisible)
     {
         this.Dispatcher.BeginInvoke(DispatcherPriority.Render, new DispatcherOperationCallback(delegate
         {
             this.InvalidateVisual();
             return(null);
         }), null);
     }
 }
Exemplo n.º 15
0
        private void OnTagsChanged(object sender, TagsChangedEventArgs e)
        {
            using (_asyncListener.BeginAsyncOperation(GetType().Name + ".OnTagsChanged.1"))
            {
                var changedSpan = e.Span;

                if (changedSpan == null)
                {
                    return; // nothing changed
                }

                var needToScheduleUpdate = false;
                lock (_invalidatedSpansLock)
                {
                    if (_invalidatedSpans == null)
                    {
                        // set invalidated spans
                        _invalidatedSpans = new List <IMappingSpan> {
                            changedSpan
                        };

                        needToScheduleUpdate = true;
                    }
                    else
                    {
                        // add to existing invalidated spans
                        _invalidatedSpans.Add(changedSpan);
                    }
                }

                if (needToScheduleUpdate)
                {
                    // schedule an update
                    _threadingContext.JoinableTaskFactory
                    .WithPriority(_textView.VisualElement.Dispatcher, DispatcherPriority.Render)
                    .RunAsync(
                        async() =>
                    {
                        using (
                            _asyncListener.BeginAsyncOperation(
                                GetType() + ".OnTagsChanged.2"
                                )
                            )
                        {
                            await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(
                                alwaysYield: true
                                );
                            UpdateInvalidSpans();
                        }
                    }
                        );
                }
            }
        }
Exemplo n.º 16
0
 void TagAggregator_TagsChanged(object?sender, TagsChangedEventArgs e)
 {
     if (ClassificationChanged is null)
     {
         return;
     }
     foreach (var span in e.Span.GetSpans(textBuffer))
     {
         ClassificationChanged?.Invoke(this, new ClassificationChangedEventArgs(span));
     }
 }
Exemplo n.º 17
0
        // Keep track of the most recent resolution results.
        void _aggregator_TagsChanged(object sender, TagsChangedEventArgs e)
        {
            var r = sender as ResolverTagger;

            if (r != null)
            {
                lock (this) {
                    resolver = r;
                }
                timer.Stop();
                timer.Start();
            }
        }
Exemplo n.º 18
0
        void _aggregator_TagsChanged(object sender, TagsChangedEventArgs e)
        {
            var chng = TagsChanged;

            if (chng != null)
            {
                NormalizedSnapshotSpanCollection spans = e.Span.GetSpans(_buffer.CurrentSnapshot);
                if (spans.Count > 0)
                {
                    SnapshotSpan span = new SnapshotSpan(spans[0].Start, spans[spans.Count - 1].End);
                    chng(this, new SnapshotSpanEventArgs(span));
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// The aggregator tags changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="TagsChangedEventArgs"/>.</param>
        private void AggregatorTagsChanged(object sender, TagsChangedEventArgs e)
        {
            var temp = TagsChanged;

            if (temp != null)
            {
                var spans = e.Span.GetSpans(Buffer.CurrentSnapshot);
                if (spans.Count > 0)
                {
                    var span = new SnapshotSpan(spans[0].Start, spans[spans.Count - 1].End);
                    temp(this, new SnapshotSpanEventArgs(span));
                }
            }
        }
        /// <summary>
        /// This handler is called when tag aggregator notifies us about tag changes.
        /// </summary>
        private void OnTagsChanged(object sender, TagsChangedEventArgs e)
        {
            using (_asyncListener.BeginAsyncOperation(GetType().Name + ".OnTagsChanged.1"))
            {
                var changedSpan = e.Span;

                if (changedSpan == null)
                {
                    return; // nothing changed
                }

                var needToScheduleUpdate = false;
                lock (_invalidatedSpansLock)
                {
                    if (_invalidatedSpans == null)
                    {
                        // set invalidated spans
                        var newInvalidatedSpans = new List <IMappingSpan>();
                        newInvalidatedSpans.Add(changedSpan);
                        _invalidatedSpans = newInvalidatedSpans;

                        needToScheduleUpdate = true;
                    }
                    else
                    {
                        // add to existing invalidated spans
                        _invalidatedSpans.Add(changedSpan);
                    }
                }

                if (needToScheduleUpdate)
                {
                    // schedule an update
                    var asyncToken = _asyncListener.BeginAsyncOperation(GetType() + ".OnTagsChanged.2");
                    _textView.VisualElement.Dispatcher.BeginInvoke(
                        new System.Action(() =>
                    {
                        try
                        {
                            UpdateInvalidSpans();
                        }
                        finally
                        {
                            asyncToken.Dispose();
                        }
                    }), DispatcherPriority.Render);
                }
            }
        }
Exemplo n.º 21
0
        private void LexTagChanged(object sender, TagsChangedEventArgs e)
        {
            lock (_updateLock)
            {
                var tempEvent = TagsChanged;

                if (tempEvent != null)
                {
                    foreach (var span in e.Span.GetSpans(_buffer))
                    {
                        tempEvent(this, new SnapshotSpanEventArgs(span));
                    }
                }
            }
        }
Exemplo n.º 22
0
        void _aggregator_TagsChanged(object sender, TagsChangedEventArgs e)
        {
            var chng = TagsChanged;

            if (chng != null)
            {
                NormalizedSnapshotSpanCollection spans = e.Span.GetSpans(_view.TextBuffer.CurrentSnapshot);
                if (spans.Count > 0)
                {
                    SnapshotSpan span = new SnapshotSpan(spans[0].Start, spans[spans.Count - 1].End);
                    _view.VisualElement.Dispatcher.Invoke(() =>
                    {
                        chng(this, new SnapshotSpanEventArgs(span));
                    });
                }
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Recheck the changed spans when tags change
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void AggregatorTagsChanged(object sender, TagsChangedEventArgs e)
        {
            if (_isClosed)
            {
                return;
            }

            NormalizedSnapshotSpanCollection dirtySpans = e.Span.GetSpans(_buffer.CurrentSnapshot);

            if (dirtySpans.Count == 0)
            {
                return;
            }

            foreach (var span in dirtySpans)
            {
                AddDirtySpan(span);
            }
        }
Exemplo n.º 24
0
        void NaturalTagsChanged(object sender, TagsChangedEventArgs e)
        {
            NormalizedSnapshotSpanCollection dirtySpans = e.Span.GetSpans(_buffer.CurrentSnapshot);

            if (dirtySpans.Count == 0)
            {
                return;
            }

            SnapshotSpan dirtySpan = new SnapshotSpan(_buffer.CurrentSnapshot, dirtySpans[0].Start, dirtySpans[dirtySpans.Count - 1].End);

            AddDirtySpan(dirtySpan);

            var temp = TagsChanged;

            if (temp != null)
            {
                temp(this, new SnapshotSpanEventArgs(dirtySpan));
            }
        }
Exemplo n.º 25
0
 private void TagsChangedOnAggregator(object sender, TagsChangedEventArgs e)
 {
     tagsChanged.Enqueue(e.Span);
     NotifyTagChanged(e.Span.AnchorBuffer.CurrentSnapshot);
 }
 void OnUnderlineTagsChanged(object sender, TagsChangedEventArgs e) {
     ClassificationChanged?.Invoke(this, new ClassificationChangedEventArgs(e.Span.GetSpans(TextBuffer)[0]));
 }
        private void HandleDataTagsChanged(object sender, TagsChangedEventArgs args)
        {
            var changedSpans = args.Span.GetSpans(view.TextBuffer.CurrentSnapshot);

            InvalidateSpans(changedSpans);
        }
Exemplo n.º 28
0
 void TagAggregator_TagsChanged(object sender, TagsChangedEventArgs e) =>
 SequenceChanged?.Invoke(this, new TextAndAdornmentSequenceChangedEventArgs(e.Span));
 void Tags_TagsChanged(object sender, TagsChangedEventArgs e)
 {
     TagsListBox.ItemsSource = Push.Instance.Tags.AllTags;
 }
Exemplo n.º 30
0
        private void OnTagsChanged(object sender, TagsChangedEventArgs e)
        {
            var snapshotSpan = e.Span.GetSnapshotSpan();//Extension method

            InvokeTagsChanged(sender, new SnapshotSpanEventArgs(snapshotSpan));
        }
Exemplo n.º 31
0
 private void LexTagChanged(object sender, TagsChangedEventArgs e)
 {
     Update();
 }
 private void OnAggregatorTagsChanged(object sender, TagsChangedEventArgs e)
 {
 }
        private void HandleDataTagsChanged(object sender, TagsChangedEventArgs args)
        {
            NormalizedSnapshotSpanCollection changedSpans = args.Span.GetSpans(View.TextBuffer.CurrentSnapshot);

            InvalidateSpans(changedSpans);
        }
Exemplo n.º 34
0
 private void OnTagsChanged(object sender, TagsChangedEventArgs e)
 {
     TagsChanged?.Invoke(sender, new SnapshotSpanEventArgs(e.Span.GetSnapshotSpan()));
 }