2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2019 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-04-04 14:36:28 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-05-19 15:51:25 +02:00
|
|
|
#include "languageclient_global.h"
|
2021-09-14 17:00:16 +02:00
|
|
|
#include "languageclientutils.h"
|
2021-05-19 15:51:25 +02:00
|
|
|
|
2019-04-04 14:36:28 +02:00
|
|
|
#include <languageserverprotocol/languagefeatures.h>
|
2020-07-22 11:34:30 +02:00
|
|
|
#include <languageserverprotocol/lsptypes.h>
|
2019-04-04 14:36:28 +02:00
|
|
|
|
2020-07-22 11:34:30 +02:00
|
|
|
#include <QMap>
|
2019-04-04 14:36:28 +02:00
|
|
|
#include <QObject>
|
2020-07-22 11:34:30 +02:00
|
|
|
#include <QSet>
|
2020-01-29 11:17:47 +01:00
|
|
|
#include <QTimer>
|
2019-04-04 14:36:28 +02:00
|
|
|
|
2022-08-26 10:30:00 +02:00
|
|
|
#include <optional>
|
|
|
|
|
|
2019-04-04 14:36:28 +02:00
|
|
|
namespace LanguageClient {
|
|
|
|
|
|
|
|
|
|
class Client;
|
|
|
|
|
|
2021-05-19 15:51:25 +02:00
|
|
|
class LANGUAGECLIENT_EXPORT DocumentSymbolCache : public QObject
|
2019-04-04 14:36:28 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
DocumentSymbolCache(Client *client);
|
|
|
|
|
|
2021-09-14 17:00:16 +02:00
|
|
|
void requestSymbols(const LanguageServerProtocol::DocumentUri &uri, Schedule schedule);
|
2019-04-04 14:36:28 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void gotSymbols(const LanguageServerProtocol::DocumentUri &uri,
|
|
|
|
|
const LanguageServerProtocol::DocumentSymbolsResult &symbols);
|
|
|
|
|
|
|
|
|
|
private:
|
2020-01-29 11:17:47 +01:00
|
|
|
void requestSymbolsImpl();
|
2019-04-04 14:36:28 +02:00
|
|
|
void handleResponse(const LanguageServerProtocol::DocumentUri &uri,
|
|
|
|
|
const LanguageServerProtocol::DocumentSymbolsRequest::Response &response);
|
|
|
|
|
|
|
|
|
|
QMap<LanguageServerProtocol::DocumentUri, LanguageServerProtocol::DocumentSymbolsResult> m_cache;
|
2022-02-07 08:07:12 +01:00
|
|
|
QMap<LanguageServerProtocol::DocumentUri, LanguageServerProtocol::MessageId> m_runningRequests;
|
2019-04-04 14:36:28 +02:00
|
|
|
Client *m_client = nullptr;
|
2020-01-29 11:17:47 +01:00
|
|
|
QTimer m_compressionTimer;
|
|
|
|
|
QSet<LanguageServerProtocol::DocumentUri> m_compressedUris;
|
2019-04-04 14:36:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace LanguageClient
|