Commit 6b80bd9a authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

implement workspace/symbols request


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 737bbf58
......@@ -55,6 +55,7 @@ static const QString MEMBER_TARGET_URI = QStringLiteral("targetUri");
static const QString MEMBER_TARGET_RANGE = QStringLiteral("targetRange");
static const QString MEMBER_TARGET_SELECTION_RANGE = QStringLiteral("targetSelectionRange");
static const QString MEMBER_PREVIOUS_RESULT_ID = QStringLiteral("previousResultId");
static const QString MEMBER_QUERY = QStringLiteral("query");
// message construction helpers
static QJsonObject to_json(const LSPPosition &pos)
......@@ -803,6 +804,12 @@ static LSPShowMessageParams parseMessage(const QJsonObject &result)
return ret;
}
static QString parseWorkspaceSymbols(const QJsonValue &result)
{
// result has an array in it
return {};
}
using GenericReplyType = QJsonValue;
using GenericReplyHandler = ReplyHandler<GenericReplyType>;
......@@ -1337,6 +1344,12 @@ public:
send(init_request(QStringLiteral("workspace/didChangeConfiguration"), params));
}
void workspaceSymbol(const QString &symbol, const GenericReplyHandler &h)
{
auto params = QJsonObject{{MEMBER_QUERY, symbol}};
send(init_request(QStringLiteral("workspace/symbol"), params), h);
}
void processNotification(const QJsonObject &msg)
{
auto method = msg[MEMBER_METHOD].toString();
......@@ -1631,3 +1644,8 @@ void LSPClientServer::didChangeConfiguration(const QJsonValue &settings)
{
return d->didChangeConfiguration(settings);
}
void LSPClientServer::workspaceSymbol(const QString &symbol, const QObject *context, const ReplyHandler<QString> &h)
{
return d->workspaceSymbol(symbol, make_handler(h, context, parseWorkspaceSymbols));
}
......@@ -168,6 +168,9 @@ public:
// misc
void didChangeConfiguration(const QJsonValue &settings);
// workspace
void workspaceSymbol(const QString &symbol, const QObject *context, const ReplyHandler<QString> &h);
// notification = signal
Q_SIGNALS:
void showMessage(const LSPShowMessageParams &);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment