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

Method showDefinition

plugins/classbrowser/classbrowserplugin.cpp:139–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void ClassBrowserPlugin::showDefinition(const DeclarationPointer& declaration)
140{
141 DUChainReadLocker readLock(DUChain::lock());
142
143 if (!declaration)
144 return;
145
146 Declaration* decl = declaration.data();
147 // If it's a function, find the function definition to go to the actual declaration.
148 if (decl && decl->isFunctionDeclaration()) {
149 if (auto* funcDefinition = FunctionDefinition::definition(decl))
150 decl = funcDefinition;
151 }
152
153 if (decl) {
154 QUrl url = decl->url().toUrl();
155 KTextEditor::Range range = decl->rangeInCurrentRevision();
156
157 readLock.unlock();
158
159 ICore::self()->documentController()->openDocument(url, range.start());
160 }
161}
162
163#include "classbrowserplugin.moc"
164#include "moc_classbrowserplugin.cpp"

Callers 1

itemActivatedMethod · 0.80

Calls 9

documentControllerMethod · 0.80
dataMethod · 0.45
isFunctionDeclarationMethod · 0.45
toUrlMethod · 0.45
urlMethod · 0.45
unlockMethod · 0.45
openDocumentMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected