LanguageClient: Allow for custom symbol search result handling

Change-Id: If19ce24b39820afbfd48c48493e07709f4b3633e
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-04-29 15:22:34 +02:00
parent 2014bf472d
commit 4890902abf
2 changed files with 42 additions and 21 deletions

View File

@@ -27,6 +27,7 @@
#include "languageclient_global.h"
#include <coreplugin/find/searchresultitem.h>
#include <texteditor/textdocument.h>
#include <languageserverprotocol/languagefeatures.h>
@@ -36,6 +37,8 @@ class SearchResult;
class SearchResultItem;
}
namespace LanguageServerProtocol { class MessageId; }
namespace LanguageClient {
class Client;
@@ -50,15 +53,24 @@ public:
const QTextCursor &cursor,
Utils::ProcessLinkCallback callback,
const bool resolveTarget);
void findUsages(TextEditor::TextDocument *document, const QTextCursor &cursor);
using ResultHandler = std::function<void(const QList<LanguageServerProtocol::Location> &)>;
Utils::optional<LanguageServerProtocol::MessageId> findUsages(
TextEditor::TextDocument *document,
const QTextCursor &cursor,
const ResultHandler &handler = {});
bool supportsRename(TextEditor::TextDocument *document);
void renameSymbol(TextEditor::TextDocument *document, const QTextCursor &cursor);
static Core::Search::TextRange convertRange(const LanguageServerProtocol::Range &range);
static QStringList getFileContents(const QString &filePath);
private:
void handleFindReferencesResponse(
const LanguageServerProtocol::FindReferencesRequest::Response &response,
const QString &wordUnderCursor);
const QString &wordUnderCursor,
const ResultHandler &handler);
void requestPrepareRename(const LanguageServerProtocol::TextDocumentPositionParams &params,
const QString &placeholder);