6#include <QtLanguageServer/private/qlanguageserverspectypes_p.h>
7#include <QtQmlDom/private/qqmldomexternalitems_p.h>
8#include <QtQmlDom/private/qqmldomtop_p.h>
21 return u
"QmlNavigationSupport"_s;
25 const QLspSpecification::InitializeParams &,
26 QLspSpecification::InitializeResult &serverCapabilities)
31 serverCapabilities.capabilities.typeDefinitionProvider =
true;
35 QLanguageServerProtocol *protocol)
52 qWarning() << u
"Could not obtain the type definition, was the type correctly resolved?"_s
53 << u
"\n Obtained type was:\n"_s <<
base.toString()
54 << u
"\nbut selected item was:\n"
55 << itemsFound->
first().domItem.toString();
60 qWarning() << u
"Could not obtain the base from the item"_s;
66 << u
"Could not obtain the text location from the base item, was it correctly resolved?\nBase was "_s
74 qWarning() << u
"Could not obtain the file of the base."_s;
78 QLspSpecification::Location l;
81 const QString qmlCode = fileOfBasePtr->code();
Implements a server for the language server protocol.
void append(parameter_type t)
std::shared_ptr< T > ownerAs()
static const FileLocations * fileLocationsOf(DomItem &)
static QQmlJS::Dom::DomItem findTypeDefinitionOf(QQmlJS::Dom::DomItem item)
Extracts the QML object type of an \l DomItem.
static QLspSpecification::Range qmlLocationToLspLocation(const QString &code, QQmlJS::SourceLocation qmlLocation)
Converts a QQmlJS::SourceLocation to a LSP Range.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString first(qsizetype n) const
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QByteArray toEncoded(FormattingOptions options=FullyEncoded) const
Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returne...
QString name() const override
void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo, QLspSpecification::InitializeResult &) override
void process(RequestPointerArgument request) override
QmlGoToTypeDefinitionSupport(QmlLsp::QQmlCodeModel *codeModel)
void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override
Combined button and popup list for selecting options.
QNetworkRequest request(url)
std::optional< QList< QQmlLSUtilsItemLocation > > itemsForRequest(const RequestPointer &request)
decltype(auto) getRequestHandler()