MCPcopy Create free account
hub / github.com/KDE/kdevelop / addHighlight

Method addHighlight

plugins/contextbrowser/contextbrowser.cpp:731–766  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731void 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
768Declaration* ContextBrowserPlugin::findDeclaration(View* view, const KTextEditor::Cursor& position, bool mouseHighlight)
769{

Callers

nothing calls this directly

Calls 9

createRangeMovingMethod · 0.80
setAttributeMethod · 0.80
setZDepthMethod · 0.80
usesCurrentRevisionMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
backMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected