public void TextViewCreated(IWpfTextView textView)
        {
            IVsTaskList tasks = serviceProvider.GetService(typeof(SVsErrorList)) as IVsTaskList;
            DTE2 dte = serviceProvider.GetService(typeof(DTE)) as DTE2;

            ITextDocument document;
            if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
            {
                var highlighter = new ErrorHighlighter(textView, document, tasks, dte);

                // On file save
                document.FileActionOccurred += (s, e) =>
                {
                    if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
                        highlighter.Update(true);
                };
            }
        }
Пример #2
0
        public void TextViewCreated(IWpfTextView textView)
        {
            IVsTaskList tasks = serviceProvider.GetService(typeof(SVsErrorList)) as IVsTaskList;
            DTE2        dte   = serviceProvider.GetService(typeof(DTE)) as DTE2;

            ITextDocument document;

            if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
            {
                var highlighter = new ErrorHighlighter(textView, document, tasks, dte, serviceProvider);

                // On file save
                document.FileActionOccurred += (s, e) =>
                {
                    if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
                    {
                        highlighter.Update(true);
                    }
                };
            }
        }