Esempio n. 1
0
        /// <summary>
        /// Tells document that massive change to text buffer is complete. Document will perform full parse,
        /// resume tracking of text buffer changes and classification (colorization).
        /// </summary>
        /// <returns>True if changes were made to the text buffer since call to BeginMassiveChange</returns>
        public bool EndMassiveChange()
        {
            bool changed = _editorTree.TreeUpdateTask.TextBufferChangedSinceSuspend;

            if (_inMassiveChange == 1)
            {
                var colorizer = ServiceManager.GetService <RClassifier>(TextBuffer);
                colorizer?.Resume();

                if (changed)
                {
                    TextChangeEventArgs textChange =
                        new TextChangeEventArgs(0, 0, TextBuffer.CurrentSnapshot.Length, 0,
                                                new TextProvider(_editorTree.TextSnapshot, partial: true),
                                                new TextStream(string.Empty));

                    List <TextChangeEventArgs> textChanges = new List <TextChangeEventArgs>();
                    textChanges.Add(textChange);
                    _editorTree.FireOnUpdatesPending(textChanges);
                }

                _editorTree.TreeUpdateTask.Resume();
                MassiveChangeEnded?.Invoke(this, EventArgs.Empty);
            }

            if (_inMassiveChange > 0)
            {
                _inMassiveChange--;
            }

            return(changed);
        }
Esempio n. 2
0
 public void FireMassiveChangeEnded() => MassiveChangeEnded?.Invoke(this, EventArgs.Empty);