31 HelpManager *helpManager =
32 m_codeModelManager->helpManagerForUrl(request->m_parameters.textDocument.uri);
36 <<
"No help manager is available, documentation hints will not function!";
39 using namespace QQmlJS::Dom;
40 QLspSpecification::Hover result;
41 ResponseScopeGuard guard(result, request->m_response);
43 qCWarning(hoverLog) <<
"No hover information is available!";
46 const auto textDocument = request->m_parameters.textDocument;
47 const auto position = request->m_parameters.position;
49 m_codeModelManager->openDocumentByUrl(QQmlLSUtils::lspUriToQmlUrl(textDocument.uri));
50 DomItem file = doc.snapshot.doc.fileObject(GoTo::MostLikely);
52 guard.setError(QQmlLSUtils::ErrorMessage{
53 0, u"Could not find the file %1"_s.arg(doc.snapshot.doc.canonicalFilePath()) });
57 const auto documentation = helpManager->documentationForItem(file, position);
58 if (!documentation.has_value()) {
61 "No documentation hints found for the item at (line, col): (%1,%2)")
63 .arg(position.character);
66 QLspSpecification::MarkupContent content;
68 content.kind = QLspSpecification::MarkupKind::Markdown;
69 content.value = documentation.value();
70 result.contents = std::move(content);