6#include <QtLanguageServer/private/qlanguageserverspectypes_p.h>
7#include <QtQmlDom/private/qqmldomexternalitems_p.h>
8#include <QtQmlDom/private/qqmldomtop_p.h>
15 :
BaseT(codeModel) { }
19 return u
"QmlFindUsagesSupport"_s;
23 const QLspSpecification::InitializeParams &,
24 QLspSpecification::InitializeResult &serverCapabilities)
29 serverCapabilities.capabilities.referencesProvider =
true;
50 itemsFound->front().domItem.top().field(QQmlJS::Dom::Fields::qmlFileWithPath);
54 for (
const auto &
usage : usages) {
55 QLspSpecification::Location
location;
58 auto cacheEntry = codeCache.
find(
usage.filename);
59 if (cacheEntry == codeCache.
end()) {
61 .field(QQmlJS::Dom::Fields::currentItem)
64 qDebug() <<
"File" <<
usage.filename <<
"not found in DOM! Available files are"
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Implements a server for the language server protocol.
void append(parameter_type t)
void setupCapabilities(const QLspSpecification::InitializeParams &clientInfo, QLspSpecification::InitializeResult &) override
void registerHandlers(QLanguageServer *server, QLanguageServerProtocol *protocol) override
QQmlFindUsagesSupport(QmlLsp::QQmlCodeModel *codeModel)
void process(RequestPointerArgument request) override
QString name() const override
static QList< QQmlLSUtilsLocation > findUsagesOf(QQmlJS::Dom::DomItem item)
static QLspSpecification::Range qmlLocationToLspLocation(const QString &code, QQmlJS::SourceLocation qmlLocation)
Converts a QQmlJS::SourceLocation to a LSP Range.
\macro QT_RESTRICTED_CAST_FROM_ASCII
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...
Combined button and popup list for selecting options.
GLsizeiptr const void GLenum usage
QNetworkRequest request(url)
std::optional< QList< QQmlLSUtilsItemLocation > > itemsForRequest(const RequestPointer &request)
decltype(auto) getRequestHandler()
RequestPointer && RequestPointerArgument