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

Method quickOpenDefinition

plugins/quickopen/quickopenplugin.cpp:674–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

672}
673
674void QuickOpenPlugin::quickOpenDefinition()
675{
676 if (jumpToSpecialObject()) {
677 return;
678 }
679
680 KDevelop::DUChainReadLocker lock(DUChain::lock());
681 Declaration* decl = cursorDeclaration();
682
683 if (!decl) {
684 qCDebug(PLUGIN_QUICKOPEN) << "Found no declaration for cursor, cannot jump";
685 return;
686 }
687
688 IndexedString u = decl->url();
689 KTextEditor::Cursor c = decl->rangeInCurrentRevision().start();
690 if (auto* def = FunctionDefinition::definition(decl)) {
691 def->activateSpecialization();
692 u = def->url();
693 c = def->rangeInCurrentRevision().start();
694 } else {
695 qCDebug(PLUGIN_QUICKOPEN) << "Found no definition for declaration";
696 decl->activateSpecialization();
697 }
698
699 if (u.isEmpty()) {
700 qCDebug(PLUGIN_QUICKOPEN) << "Got empty url for declaration" << decl->toString();
701 return;
702 }
703
704 lock.unlock();
705 core()->documentController()->openDocument(u.toUrl(), c);
706}
707
708bool QuickOpenPlugin::freeModel()
709{

Callers

nothing calls this directly

Calls 11

documentControllerMethod · 0.80
cursorDeclarationFunction · 0.70
urlMethod · 0.45
startMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45
unlockMethod · 0.45
openDocumentMethod · 0.45
toUrlMethod · 0.45

Tested by

no test coverage detected