17 return u
"QQmlHover"_s;
26 const QLspSpecification::InitializeParams &,
27 QLspSpecification::InitializeResult &serverCapabilities)
29 serverCapabilities.capabilities.hoverProvider =
true;
35 QLspSpecification::Hover
result;
39 qCWarning(hoverLog) <<
"No hover information is available!";
43 const auto textDocument =
request->m_parameters.textDocument;
44 const auto [hoveredLine, hoveredCharacter] =
request->m_parameters.position;
45 qCDebug(hoverLog) <<
QStringLiteral(
"Hovered (line, col): (%1,%2)").arg(hoveredLine).arg(hoveredCharacter);
50 DomItem file = doc.snapshot.doc.fileObject(GoTo::MostLikely);
53 0, u
"Could not find the file %1"_s.arg(doc.snapshot.doc.canonicalFilePath()) });
61 file, { hoveredLine + 1, hoveredCharacter + 1 });
62 if (documentation.isEmpty()) {
65 "No documentation hints found for the item at (line, col): (%1,%2)")
67 .arg(hoveredCharacter);
71 QLspSpecification::MarkupContent content;
75 content.kind = QLspSpecification::MarkupKind::PlainText;
76 content.value = documentation;
Implements a server for the language server protocol.
void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override
void process(RequestPointerArgument req) override
void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo, QLspSpecification::InitializeResult &) override
QString name() const override
static QByteArray lspUriToQmlUrl(const QByteArray &uri)
static QByteArray getDocumentationFromLocation(const DomItem &file, const QQmlLSUtilsTextPosition &position)
\macro QT_RESTRICTED_CAST_FROM_ASCII
OpenDocument openDocumentByUrl(const QByteArray &url)
Combined button and popup list for selecting options.
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
#define QStringLiteral(str)
QNetworkRequest request(url)
decltype(auto) getRequestHandler()
QmlLsp::QQmlCodeModel * m_codeModel
This class sends a result or an error when going out of scope.
void setError(const QQmlLSUtilsErrorMessage &error)