internal XSharpFormattingCommandHandler(IVsTextView textViewAdapter, ITextView textView,
                                                IBufferTagAggregatorFactoryService aggregator)
        {
            this._textView         = textView;
            this._textView.Closed += OnClosed;
            this._aggregator       = aggregator;
            //add this to the filter chain
            _linesToSync = new List <int>();
            //
            _buffer = _textView.TextBuffer;
            if (_buffer != null)
            {
                _buffer.ChangedLowPriority += Textbuffer_Changed;
                _buffer.Changing           += Textbuffer_Changing;
                _file = _buffer.GetFile();

                if (_buffer.CheckEditAccess())
                {
                    //formatCaseForWholeBuffer();
                }
            }
            if (_file != null)
            {
                _settings = EditorConfigReader.ReadSettings(_buffer, _file.FullPath);
            }

            textViewAdapter.AddCommandFilter(this, out m_nextCommandHandler);
            registerClassifier();
        }
Example #2
0
        /// <summary>
        /// Reload the source code editor settings for all open X# editor windows
        /// </summary>
        /// <returns></returns>
        private async System.Threading.Tasks.Task RefreshDocumentSettingsAsync()
        {
            var docs = await VS.Windows.GetAllDocumentWindowsAsync();

            foreach (var doc in docs)
            {
                var view = await doc.GetDocumentViewAsync();

                var buffer = view.TextBuffer;
                if (buffer.GetClassifier() != null)
                {
                    EditorConfigReader.ReadSettings(buffer, view.FilePath);
                }
            }
            return;
        }