6#include <QtLanguageServer/private/qlanguageserverspectypes_p.h>
7#include <QtQmlDom/private/qqmldomexternalitems_p.h>
8#include <QtQmlDom/private/qqmldomtop_p.h>
21 return u
"QmlDefinitionSupport"_s;
25 const QLspSpecification::InitializeParams &,
26 QLspSpecification::InitializeResult &serverCapabilities)
31 serverCapabilities.capabilities.definitionProvider =
true;
35 QLanguageServerProtocol *protocol)
42 QList<QLspSpecification::Location>
results;
56 QLspSpecification::Location l;
62 qDebug() <<
"Could not find file" <<
location->filename <<
"in the dom!";
65 const QString qmlCode = fileOfBasePtr->code();
Implements a server for the language server protocol.
void append(parameter_type t)
DomItem goToFile(const QString &filePath) const
A QmlFile, when loaded in a DomEnvironment that has the DomCreationOption::WithSemanticAnalysis,...
static QLspSpecification::Range qmlLocationToLspLocation(const QString &code, QQmlJS::SourceLocation qmlLocation)
Converts a QQmlJS::SourceLocation to a LSP Range.
static std::optional< QQmlLSUtilsLocation > findDefinitionOf(const DomItem &item)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
void process(RequestPointerArgument request) override
QmlGoToDefinitionSupport(QmlLsp::QQmlCodeModel *codeModel)
void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override
QString name() const override
void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo, QLspSpecification::InitializeResult &) override
Combined button and popup list for selecting options.
QNetworkRequest request(url)
decltype(auto) getRequestHandler()
std::variant< QList< QQmlLSUtilsItemLocation >, QQmlLSUtilsErrorMessage > itemsForRequest(const RequestPointer &request)
QQmlJS::Dom::DomItem domItem
This class sends a result or an error when going out of scope.
bool setErrorFrom(const std::variant< T... > &variant)