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

Method specialLanguageObjectNavigationWidget

plugins/qmljs/kdevqmljsplugin.cpp:168–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168QPair<QWidget*, KTextEditor::Range> KDevQmlJsPlugin::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position)
169{
170 IDocument* doc = ICore::self()->documentController()->documentForUrl(url);
171 if ( doc && doc->textDocument() ) {
172 // Check for a QML property, and construct a property preview widget
173 // if the property key is listed in the supported properties.
174 QPair<KTextEditor::Range, KTextEditor::Range> property = parseProperty(doc->textDocument()->line(position.line()), position);
175 if ( property.first.isValid() && property.second.isValid() ) {
176 const auto itemUnderCursor = DUChainUtils::itemUnderCursor(url, property.first.start());
177
178 return {PropertyPreviewWidget::constructIfPossible(
179 doc->textDocument(),
180 property.first,
181 property.second,
182 itemUnderCursor.declaration,
183 textFromDoc(doc, property.first),
184 textFromDoc(doc, property.second)
185 ), itemUnderCursor.range};
186 }
187 }
188 // Otherwise, display no special "navigation" widget.
189 return KDevelop::ILanguageSupport::specialLanguageObjectNavigationWidget(url, position);
190}
191
192#include "kdevqmljsplugin.moc"
193#include "moc_kdevqmljsplugin.cpp"

Callers 1

Calls 8

parsePropertyFunction · 0.85
textFromDocFunction · 0.85
documentForUrlMethod · 0.80
documentControllerMethod · 0.80
textDocumentMethod · 0.45
lineMethod · 0.45
isValidMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected