38 HelpManager *helpManager =
39 m_codeModelManager->helpManagerForUrl(request->m_parameters.textDocument.uri);
43 <<
"No help manager is available, documentation hints will not function!";
46 using namespace QQmlJS::Dom;
47 QLspSpecification::Hover result;
50 qCWarning(hoverLog) <<
"No hover information is available!";
53 const auto textDocument = request->m_parameters.textDocument;
54 const auto position = request->m_parameters.position;
56 m_codeModelManager->openDocumentByUrl(QQmlLSUtils::lspUriToQmlUrl(textDocument.uri));
57 DomItem file = doc.snapshot.doc.fileObject(GoTo::MostLikely);
59 guard.setError(QQmlLSUtils::ErrorMessage{
60 0, u"Could not find the file %1"_s.arg(doc.snapshot.doc.canonicalFilePath()) });
64 const auto documentation = helpManager->documentationForItem(file, position);
65 if (!documentation.has_value()) {
68 "No documentation hints found for the item at (line, col): (%1,%2)")
70 .arg(position.character);
73 QLspSpecification::MarkupContent content;
75 content.kind = QLspSpecification::MarkupKind::Markdown;
76 content.value = documentation.value();
77 result.contents =
std::move(content);