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

Method specialLanguageObjectNavigationWidget

plugins/cmake/cmakemanager.cpp:695–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693}
694
695QPair<QWidget*, KTextEditor::Range> CMakeManager::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position)
696{
697 KTextEditor::Range itemRange;
698 CMakeNavigationWidget* doc = nullptr;
699
700 KDevelop::TopDUContextPointer top= TopDUContextPointer(KDevelop::DUChain::self()->chainForDocument(url));
701 if(top)
702 {
703 int useAt=top->findUseAt(top->transformToLocalRevision(position));
704 if(useAt>=0)
705 {
706 Use u=top->uses()[useAt];
707 doc = new CMakeNavigationWidget(top, u.usedDeclaration(top->topContext()));
708 itemRange = u.m_range.castToSimpleRange();
709 }
710 }
711
712 if (!doc) {
713 ICMakeDocumentation* docu=CMake::cmakeDocumentation();
714 if( docu )
715 {
716 const auto* document = ICore::self()->documentController()->documentForUrl(url);
717 const auto* textDocument = document->textDocument();
718 itemRange = termRangeAtPosition(textDocument, position);
719 if (itemRange.isValid()) {
720 const auto id = textDocument->text(itemRange);
721
722 if (!id.isEmpty()) {
723 IDocumentation::Ptr desc=docu->description(id, url);
724 if (desc) {
725 doc=new CMakeNavigationWidget(top, desc);
726 }
727 }
728 }
729 }
730 }
731
732 return {doc, itemRange};
733}
734
735QPair<QString, QString> CMakeManager::cacheValue(KDevelop::IProject* /*project*/, const QString& /*id*/) const
736{ return QPair<QString, QString>(); }

Callers

nothing calls this directly

Calls 14

cmakeDocumentationFunction · 0.85
chainForDocumentMethod · 0.80
findUseAtMethod · 0.80
usedDeclarationMethod · 0.80
documentForUrlMethod · 0.80
documentControllerMethod · 0.80
usesMethod · 0.45
topContextMethod · 0.45
textDocumentMethod · 0.45
isValidMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected