internal CodeDocumentViewModelBase(IEditorDoc doc) : base(doc) { DiagnosticHighlighter = new DiagnosticHighlighter(new Highlighting.Highlighter(TextDocument)); SearchHighlighter = new SearchHighlighter(Document.File.Path, new Highlighting.Highlighter(TextDocument)); _indexHighlighter = new IndexHighlighter(new Highlighting.Highlighter(TextDocument)); if(HasIndex) { JadeCore.Services.Provider.CppParser.TranslationUnitIndexed += OnCppParserTranslationUnitIndexed; //DiagnosticHighlighter.ProjectItem = Document.Project.Index.FindProjectItem(Document.File.Path); _inspectSymbolCommand = new Commands.InspectSymbolCommand(this, doc.File.Path, doc.Project.Index); _inspectCursorCommand = new Commands.InspectCursorCommand(this, doc.File.Path, doc.Project.Index); _jumpToCommand = new Commands.SourceFileJumpToCommand(this, doc.File.Path, doc.Project.Index); _findAllRefsCommand = new Commands.FindAllReferences(this, doc.File.Path, doc.Project.Index); _fileMap = Document.Project.Index.FileSymbolMaps.GetMap(Document.File.Path); if (_fileMap != null) { _indexHighlighter.SetMap(_fileMap); } } }
private void OnCppParserTranslationUnitIndexed(CppCodeBrowser.ParseResult result) { if (result.Path != Document.File.Path) return; //highlight the symbol mappings if (_fileMap == null) { _fileMap = result.Index.FileSymbolMaps.GetMap(Document.File.Path); if (_fileMap != null) { _indexHighlighter.SetMap(_fileMap); } } /* CppCodeBrowser.IProjectFile fileIndex = result.Index.FindProjectItem(Document.File.Path); //highlight diagnostics List<LibClang.Diagnostic> diags = new List<Diagnostic>(fileIndex.Diagnostics); DiagnosticOutputWriter.UpdateOutput(diags); * */ }