LanguageClient: Allow to log to console rather than message window

And make use of that in ClangdClient.
When I get a slowdown while typing, it is usually accompanied by the
clangd message "Request cancelled because the document was modified"
occurring in the message window, often many times in a row. I'd like to
find out whether writing to the message window itself is a contributing
factor to the slowdown.

Change-Id: Iff7c459af0aed27d22366b9aade573f51eb5dbc7
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-10-15 10:40:02 +02:00
parent a0a1495d20
commit 40f863b9cf
3 changed files with 12 additions and 1 deletions

View File

@@ -189,6 +189,8 @@ public:
void setCompletionAssistProvider(LanguageClientCompletionAssistProvider *provider);
// logging
enum class LogTarget { Console, Ui };
void setLogTarget(LogTarget target) { m_logTarget = target; }
void log(const QString &message) const;
template<typename Error>
void log(const LanguageServerProtocol::ResponseError<Error> &responseError) const
@@ -288,6 +290,7 @@ private:
QString m_serverName;
QString m_serverVersion;
LanguageServerProtocol::SymbolStringifier m_symbolStringifier;
LogTarget m_logTarget = LogTarget::Ui;
bool m_locatorsEnabled = true;
bool m_autoRequestCodeActions = true;
};