| 166 | } |
| 167 | |
| 168 | QPair<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" |
no test coverage detected