forked from qt-creator/qt-creator
Clang: Avoid multi-line display name for completion items
These come directly from clang. If converting for display in the completion list widget, skip new line chunks. Fixes: QTCREATORBUG-21600 Change-Id: I83749ed73fa68658ec073d97177768f59a87cebf Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "clangcompletionchunkstotextconverter.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
@@ -70,6 +72,11 @@ void CompletionChunksToTextConverter::setAddSpaces(bool addSpaces)
|
||||
m_addSpaces = addSpaces;
|
||||
}
|
||||
|
||||
void CompletionChunksToTextConverter::setHonorVerticalSpace(bool honor)
|
||||
{
|
||||
m_honorVerticalSpace = honor;
|
||||
}
|
||||
|
||||
void CompletionChunksToTextConverter::setAddExtraVerticalSpaceBetweenBraces(
|
||||
bool addExtraVerticalSpaceBetweenBraces)
|
||||
{
|
||||
@@ -145,6 +152,8 @@ QString CompletionChunksToTextConverter::convertToName(
|
||||
{
|
||||
CompletionChunksToTextConverter converter;
|
||||
|
||||
converter.setHonorVerticalSpace(false);
|
||||
|
||||
converter.parseChunks(codeCompletionChunks);
|
||||
|
||||
return converter.text();
|
||||
@@ -183,6 +192,10 @@ void CompletionChunksToTextConverter::parse(
|
||||
parsePlaceHolder(codeCompletionChunk); break;
|
||||
case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break;
|
||||
case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break;
|
||||
case CodeCompletionChunk::VerticalSpace:
|
||||
if (!m_honorVerticalSpace)
|
||||
break;
|
||||
Q_FALLTHROUGH();
|
||||
default: parseText(codeCompletionChunk.text); break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user