36 QList<QLspSpecification::Location> results;
37 ResponseScopeGuard guard(results, request->m_response);
39 auto itemsFound = itemsForRequest(request);
40 if (!itemsFound.has_value()) {
41 guard.setError(itemsFound.error());
45 auto &front = itemsFound.value().front();
47 const QByteArray shortestRootUrl =
48 m_codeModelManager->shortestRootUrlForFile(request->m_parameters.textDocument.uri);
50 const QStringList headerDirectories = shortestRootUrl.isEmpty()
52 : QStringList{ QUrl::fromEncoded(shortestRootUrl).toLocalFile() };
54 const auto locations = QQmlLSUtils::findDefinitionOf(front.domItem, headerDirectories);
56 for (
const QQmlLSUtils::Location &location : locations) {
57 results.append({ QUrl::fromLocalFile(location.filename()).toEncoded(),
58 QQmlLSUtils::qmlLocationToLspLocation(location) });