forked from qt-creator/qt-creator
Clang: Typedef some often used types
using CodeCompletions = QVector<CodeCompletion>; using CodeCompletionChunks = QVector<CodeCompletionChunk>; Change-Id: Id729a43566c23dc000e44d79ccf4a49e4f235f51 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
using ClangBackEnd::CodeCompletion;
|
||||
using TextEditor::AssistProposalItem;
|
||||
|
||||
namespace {
|
||||
@@ -107,7 +108,6 @@ QList<AssistProposalItem *> toAssistProposalItems(const CodeCompletions &complet
|
||||
}
|
||||
|
||||
// FIXME: show the effective accessebility instead of availability
|
||||
using ClangBackEnd::CodeCompletion;
|
||||
using CPlusPlus::Icons;
|
||||
|
||||
switch (ccr.completionKind()) {
|
||||
@@ -193,10 +193,10 @@ bool isFunctionHintLikeCompletion(CodeCompletion::Kind kind)
|
||||
|| kind == CodeCompletion::SlotCompletionKind;
|
||||
}
|
||||
|
||||
QVector<CodeCompletion> matchingFunctionCompletions(const QVector<CodeCompletion> completions,
|
||||
const QString &functionName)
|
||||
CodeCompletions matchingFunctionCompletions(const CodeCompletions completions,
|
||||
const QString &functionName)
|
||||
{
|
||||
QVector<CodeCompletion> matching;
|
||||
CodeCompletions matching;
|
||||
|
||||
foreach (const CodeCompletion &completion, completions) {
|
||||
if (isFunctionHintLikeCompletion(completion.completionKind())
|
||||
|
||||
@@ -34,20 +34,16 @@
|
||||
#include "clangcompletionassistinterface.h"
|
||||
|
||||
#include <cpptools/cppcompletionassistprocessor.h>
|
||||
|
||||
#include <texteditor/texteditor.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <clangbackendipc/codecompletion.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
class CodeCompletion;
|
||||
}
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
using CodeCompletions = QVector<ClangBackEnd::CodeCompletion>;
|
||||
using ClangBackEnd::CodeCompletion;
|
||||
using ClangBackEnd::CodeCompletions;
|
||||
|
||||
class ClangCompletionAssistProcessor : public CppTools::CppCompletionAssistProcessor
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Internal {
|
||||
|
||||
using namespace CPlusPlus;
|
||||
|
||||
ClangFunctionHintModel::ClangFunctionHintModel(const CodeCompletions &functionSymbols)
|
||||
ClangFunctionHintModel::ClangFunctionHintModel(const ClangBackEnd::CodeCompletions &functionSymbols)
|
||||
: m_functionSymbols(functionSymbols)
|
||||
, m_currentArg(-1)
|
||||
{
|
||||
|
||||
@@ -38,12 +38,10 @@
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
using CodeCompletions = QVector<ClangBackEnd::CodeCompletion>;
|
||||
|
||||
class ClangFunctionHintModel : public TextEditor::IFunctionHintProposalModel
|
||||
{
|
||||
public:
|
||||
ClangFunctionHintModel(const CodeCompletions &functionSymbols);
|
||||
ClangFunctionHintModel(const ClangBackEnd::CodeCompletions &functionSymbols);
|
||||
|
||||
void reset() override;
|
||||
int size() const override;
|
||||
@@ -51,7 +49,7 @@ public:
|
||||
int activeArgument(const QString &prefix) const override;
|
||||
|
||||
private:
|
||||
CodeCompletions m_functionSymbols;
|
||||
ClangBackEnd::CodeCompletions m_functionSymbols;
|
||||
mutable int m_currentArg;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
void CompletionChunksToTextConverter::parseChunks(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks)
|
||||
void CompletionChunksToTextConverter::parseChunks(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks)
|
||||
{
|
||||
m_text.clear();
|
||||
m_placeholderPositions.clear();
|
||||
@@ -94,7 +94,7 @@ bool CompletionChunksToTextConverter::hasPlaceholderPositions() const
|
||||
return m_placeholderPositions.size() > 0;
|
||||
}
|
||||
|
||||
QString CompletionChunksToTextConverter::convertToFunctionSignature(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks)
|
||||
QString CompletionChunksToTextConverter::convertToFunctionSignature(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks)
|
||||
{
|
||||
CompletionChunksToTextConverter converter;
|
||||
converter.setAddPlaceHolderText(true);
|
||||
@@ -105,7 +105,7 @@ QString CompletionChunksToTextConverter::convertToFunctionSignature(const QVecto
|
||||
return converter.text();
|
||||
}
|
||||
|
||||
QString CompletionChunksToTextConverter::convertToName(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks)
|
||||
QString CompletionChunksToTextConverter::convertToName(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks)
|
||||
{
|
||||
CompletionChunksToTextConverter converter;
|
||||
|
||||
@@ -114,7 +114,7 @@ QString CompletionChunksToTextConverter::convertToName(const QVector<ClangBackEn
|
||||
return converter.text();
|
||||
}
|
||||
|
||||
QString CompletionChunksToTextConverter::convertToToolTip(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks)
|
||||
QString CompletionChunksToTextConverter::convertToToolTip(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks)
|
||||
{
|
||||
CompletionChunksToTextConverter converter;
|
||||
converter.setAddPlaceHolderText(true);
|
||||
@@ -196,7 +196,7 @@ void CompletionChunksToTextConverter::addExtraVerticalSpaceBetweenBraces()
|
||||
addExtraVerticalSpaceBetweenBraces(m_codeCompletionChunks.begin());
|
||||
}
|
||||
|
||||
void CompletionChunksToTextConverter::addExtraVerticalSpaceBetweenBraces(const QVector<ClangBackEnd::CodeCompletionChunk>::iterator &begin)
|
||||
void CompletionChunksToTextConverter::addExtraVerticalSpaceBetweenBraces(const ClangBackEnd::CodeCompletionChunks::iterator &begin)
|
||||
{
|
||||
using ClangBackEnd::CodeCompletionChunk;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Internal {
|
||||
class CompletionChunksToTextConverter
|
||||
{
|
||||
public:
|
||||
void parseChunks(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks);
|
||||
void parseChunks(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks);
|
||||
|
||||
void setAddPlaceHolderText(bool addPlaceHolderText);
|
||||
void setAddPlaceHolderPositions(bool addPlaceHolderPositions);
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
const std::vector<int> &placeholderPositions() const;
|
||||
bool hasPlaceholderPositions() const;
|
||||
|
||||
static QString convertToFunctionSignature(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks);
|
||||
static QString convertToName(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks);
|
||||
static QString convertToToolTip(const QVector<ClangBackEnd::CodeCompletionChunk> &codeCompletionChunks);
|
||||
static QString convertToFunctionSignature(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks);
|
||||
static QString convertToName(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks);
|
||||
static QString convertToToolTip(const ClangBackEnd::CodeCompletionChunks &codeCompletionChunks);
|
||||
private:
|
||||
void parse(const ClangBackEnd::CodeCompletionChunk & codeCompletionChunk);
|
||||
void parseResultType(const Utf8String &text);
|
||||
@@ -69,13 +69,13 @@ private:
|
||||
void parseLeftParen(const ClangBackEnd::CodeCompletionChunk &codeCompletionChunk);
|
||||
void parseLeftBrace(const ClangBackEnd::CodeCompletionChunk &codeCompletionChunk);
|
||||
void addExtraVerticalSpaceBetweenBraces();
|
||||
void addExtraVerticalSpaceBetweenBraces(const QVector<ClangBackEnd::CodeCompletionChunk>::iterator &);
|
||||
void addExtraVerticalSpaceBetweenBraces(const ClangBackEnd::CodeCompletionChunks::iterator &);
|
||||
|
||||
bool canAddSpace() const;
|
||||
|
||||
private:
|
||||
std::vector<int> m_placeholderPositions;
|
||||
QVector<ClangBackEnd::CodeCompletionChunk> m_codeCompletionChunks;
|
||||
ClangBackEnd::CodeCompletionChunks m_codeCompletionChunks;
|
||||
ClangBackEnd::CodeCompletionChunk m_previousCodeCompletionChunk;
|
||||
QString m_text;
|
||||
bool m_addPlaceHolderText = false;
|
||||
|
||||
Reference in New Issue
Block a user