| 729 | } |
| 730 | |
| 731 | void ContextBrowserPlugin::addHighlight(View* view, KDevelop::Declaration* decl) |
| 732 | { |
| 733 | if (!view || !decl) { |
| 734 | qCDebug(PLUGIN_CONTEXTBROWSER) << "invalid view/declaration"; |
| 735 | return; |
| 736 | } |
| 737 | |
| 738 | ViewHighlights& highlights(m_highlightedRanges[view]); |
| 739 | |
| 740 | KDevelop::DUChainReadLocker lock; |
| 741 | |
| 742 | // Highlight the declaration |
| 743 | highlights.highlights << decl->createRangeMoving(); |
| 744 | highlights.highlights.back()->setAttribute(highlightedUseAttribute()); |
| 745 | highlights.highlights.back()->setZDepth(highlightingZDepth); |
| 746 | |
| 747 | // Highlight uses |
| 748 | { |
| 749 | const auto currentRevisionUses = decl->usesCurrentRevision(); |
| 750 | for (auto fileIt = currentRevisionUses.constBegin(); fileIt != currentRevisionUses.constEnd(); ++fileIt) { |
| 751 | const auto& document = fileIt.key(); |
| 752 | const auto& documentUses = fileIt.value(); |
| 753 | for (auto& use : documentUses) { |
| 754 | highlights.highlights << PersistentMovingRange::Ptr(new PersistentMovingRange(use, document)); |
| 755 | highlights.highlights.back()->setAttribute(highlightedUseAttribute()); |
| 756 | highlights.highlights.back()->setZDepth(highlightingZDepth); |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | if (auto* def = FunctionDefinition::definition(decl)) { |
| 762 | highlights.highlights << def->createRangeMoving(); |
| 763 | highlights.highlights.back()->setAttribute(highlightedUseAttribute()); |
| 764 | highlights.highlights.back()->setZDepth(highlightingZDepth); |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | Declaration* ContextBrowserPlugin::findDeclaration(View* view, const KTextEditor::Cursor& position, bool mouseHighlight) |
| 769 | { |
nothing calls this directly
no test coverage detected