aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/languageclient
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2019-05-08 12:08:39 +0200
committerDavid Schulz <david.schulz@qt.io>2019-05-09 06:25:53 +0000
commitea81b676c76ebbb20d47b5943e808524966784c8 (patch)
tree8f0cd6f745e7a8c94e9c9c54b544ce42cbdff38b /src/plugins/languageclient
parente0a1b31e2918f6093a953b534629ef11224ab69d (diff)
LSP: log non protocol lines instead of throwing an error
Some language server send non protocol conform lines over the same transport layer as the protocol messages. Do not switch the client for those servers into the error state, but print a warning message with the content of these lines to a categorized log. Change-Id: Ic6c62648f0237362136fd657fde71dd104bca9d1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/languageclient')
-rw-r--r--src/plugins/languageclient/languageclientinterface.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/languageclient/languageclientinterface.cpp b/src/plugins/languageclient/languageclientinterface.cpp
index 389ed0517f..91d2562e67 100644
--- a/src/plugins/languageclient/languageclientinterface.cpp
+++ b/src/plugins/languageclient/languageclientinterface.cpp
@@ -35,7 +35,6 @@
using namespace LanguageServerProtocol;
static Q_LOGGING_CATEGORY(LOGLSPCLIENTV, "qtc.languageclient.messages", QtWarningMsg);
-static Q_LOGGING_CATEGORY(LOGLSPCLIENTPARSE, "qtc.languageclient.parse", QtWarningMsg);
namespace LanguageClient {
@@ -64,8 +63,8 @@ void BaseClientInterface::resetBuffer()
void BaseClientInterface::parseData(const QByteArray &data)
{
const qint64 preWritePosition = m_buffer.pos();
- qCDebug(LOGLSPCLIENTPARSE) << "parse buffer pos: " << preWritePosition;
- qCDebug(LOGLSPCLIENTPARSE) << " data: " << data;
+ qCDebug(parseLog) << "parse buffer pos: " << preWritePosition;
+ qCDebug(parseLog) << " data: " << data;
if (!m_buffer.atEnd())
m_buffer.seek(preWritePosition + m_buffer.bytesAvailable());
m_buffer.write(data);
@@ -73,9 +72,9 @@ void BaseClientInterface::parseData(const QByteArray &data)
while (!m_buffer.atEnd()) {
QString parseError;
BaseMessage::parse(&m_buffer, parseError, m_currentMessage);
- qCDebug(LOGLSPCLIENTPARSE) << " complete: " << m_currentMessage.isComplete();
- qCDebug(LOGLSPCLIENTPARSE) << " length: " << m_currentMessage.contentLength;
- qCDebug(LOGLSPCLIENTPARSE) << " content: " << m_currentMessage.content;
+ qCDebug(parseLog) << " complete: " << m_currentMessage.isComplete();
+ qCDebug(parseLog) << " length: " << m_currentMessage.contentLength;
+ qCDebug(parseLog) << " content: " << m_currentMessage.content;
if (!parseError.isEmpty())
emit error(parseError);
if (!m_currentMessage.isComplete())