forked from qt-creator/qt-creator
Clang: Integrate highlighting results from backend
Change-Id: I2c3fb69aabfe075bde76d63eafc2ca370f17493c Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
eb2457869d
commit
7ce9ef9db4
@@ -42,10 +42,13 @@ SOURCES += $$PWD/ipcserverinterface.cpp \
|
||||
$$PWD/sourcelocationcontainer.cpp \
|
||||
$$PWD/fixitcontainer.cpp \
|
||||
$$PWD/requestdiagnosticsmessage.cpp \
|
||||
$$PWD/requesthighlightingmessage.cpp \
|
||||
$$PWD/registerunsavedfilesforeditormessage.cpp \
|
||||
$$PWD/unregisterunsavedfilesforeditormessage.cpp \
|
||||
$$PWD/updatetranslationunitsforeditormessage.cpp \
|
||||
$$PWD/updatevisibletranslationunitsmessage.cpp
|
||||
$$PWD/updatevisibletranslationunitsmessage.cpp \
|
||||
$$PWD/highlightingchangedmessage.cpp \
|
||||
$$PWD/highlightingmarkcontainer.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/ipcserverinterface.h \
|
||||
@@ -84,9 +87,12 @@ HEADERS += \
|
||||
$$PWD/sourcelocationcontainer.h \
|
||||
$$PWD/fixitcontainer.h \
|
||||
$$PWD/requestdiagnosticsmessage.h \
|
||||
$$PWD/requesthighlightingmessage.h \
|
||||
$$PWD/registerunsavedfilesforeditormessage.h \
|
||||
$$PWD/unregisterunsavedfilesforeditormessage.h \
|
||||
$$PWD/updatetranslationunitsforeditormessage.h \
|
||||
$$PWD/updatevisibletranslationunitsmessage.h
|
||||
$$PWD/updatevisibletranslationunitsmessage.h \
|
||||
$$PWD/highlightingchangedmessage.h \
|
||||
$$PWD/highlightingmarkcontainer.h
|
||||
|
||||
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
#include "diagnosticschangedmessage.h"
|
||||
#include "registerunsavedfilesforeditormessage.h"
|
||||
#include "requestdiagnosticsmessage.h"
|
||||
#include "requesthighlightingmessage.h"
|
||||
#include "highlightingchangedmessage.h"
|
||||
#include "highlightingmarkcontainer.h"
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "sourcelocationcontainer.h"
|
||||
#include "sourcerangecontainer.h"
|
||||
@@ -83,6 +86,9 @@ void Messages::registerMessages()
|
||||
registerMetaType<RequestDiagnosticsMessage>();
|
||||
registerMetaType<DiagnosticsChangedMessage>();
|
||||
|
||||
registerMetaType<RequestHighlightingMessage>();
|
||||
registerMetaType<HighlightingChangedMessage>();
|
||||
|
||||
registerMetaType<UpdateVisibleTranslationUnitsMessage>();
|
||||
|
||||
registerMetaType<CompleteCodeMessage>();
|
||||
@@ -94,6 +100,7 @@ void Messages::registerMessages()
|
||||
|
||||
// Containers
|
||||
registerMetaType<DiagnosticContainer>();
|
||||
registerMetaType<HighlightingMarkContainer>();
|
||||
registerMetaType<FileContainer>();
|
||||
registerMetaType<ProjectPartContainer>();
|
||||
registerMetaType<SourceLocationContainer>();
|
||||
|
||||
119
src/libs/clangbackendipc/highlightingchangedmessage.cpp
Normal file
119
src/libs/clangbackendipc/highlightingchangedmessage.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "highlightingchangedmessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
HighlightingChangedMessage::HighlightingChangedMessage(const FileContainer &file,
|
||||
const QVector<HighlightingMarkContainer> &highlightingMarks,
|
||||
const QVector<SourceRangeContainer> &skippedPreprocessorRanges)
|
||||
: file_(file),
|
||||
highlightingMarks_(highlightingMarks),
|
||||
skippedPreprocessorRanges_(skippedPreprocessorRanges)
|
||||
{
|
||||
}
|
||||
|
||||
const FileContainer &HighlightingChangedMessage::file() const
|
||||
{
|
||||
return file_;
|
||||
}
|
||||
|
||||
const QVector<HighlightingMarkContainer> &HighlightingChangedMessage::highlightingMarks() const
|
||||
{
|
||||
return highlightingMarks_;
|
||||
}
|
||||
|
||||
const QVector<SourceRangeContainer> &HighlightingChangedMessage::skippedPreprocessorRanges() const
|
||||
{
|
||||
return skippedPreprocessorRanges_;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message)
|
||||
{
|
||||
out << message.file_;
|
||||
out << message.highlightingMarks_;
|
||||
out << message.skippedPreprocessorRanges_;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message)
|
||||
{
|
||||
in >> message.file_;
|
||||
in >> message.highlightingMarks_;
|
||||
in >> message.skippedPreprocessorRanges_;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second)
|
||||
{
|
||||
return first.file_ == second.file_
|
||||
&& first.highlightingMarks_ == second.highlightingMarks_
|
||||
&& first.skippedPreprocessorRanges_ == second.skippedPreprocessorRanges_;
|
||||
}
|
||||
|
||||
bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second)
|
||||
{
|
||||
return first.file_ < second.file_
|
||||
&& compareContainer(first.highlightingMarks_, second.highlightingMarks_)
|
||||
&& compareContainer(first.skippedPreprocessorRanges_, second.skippedPreprocessorRanges_);
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message)
|
||||
{
|
||||
debug.nospace() << "HighlightingChangedMessage("
|
||||
<< message.file_
|
||||
<< ", " << message.highlightingMarks_.size()
|
||||
<< ", " << message.skippedPreprocessorRanges_.size()
|
||||
<< ")";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os)
|
||||
{
|
||||
*os << "HighlightingChangedMessage(";
|
||||
PrintTo(message.file(), os);
|
||||
*os << "," << message.highlightingMarks().size();
|
||||
*os << "," << message.skippedPreprocessorRanges().size();
|
||||
*os << ")";
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
80
src/libs/clangbackendipc/highlightingchangedmessage.h
Normal file
80
src/libs/clangbackendipc/highlightingchangedmessage.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H
|
||||
#define CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
#include "filecontainer.h"
|
||||
#include "highlightingmarkcontainer.h"
|
||||
#include "sourcerangecontainer.h"
|
||||
|
||||
#include <QVector>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT HighlightingChangedMessage
|
||||
{
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message);
|
||||
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
|
||||
friend void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os);
|
||||
|
||||
public:
|
||||
HighlightingChangedMessage() = default;
|
||||
HighlightingChangedMessage(const FileContainer &file,
|
||||
const QVector<HighlightingMarkContainer> &highlightingMarks,
|
||||
const QVector<SourceRangeContainer> &skippedPreprocessorRanges);
|
||||
|
||||
const FileContainer &file() const;
|
||||
const QVector<HighlightingMarkContainer> &highlightingMarks() const;
|
||||
const QVector<SourceRangeContainer> &skippedPreprocessorRanges() const;
|
||||
|
||||
private:
|
||||
FileContainer file_;
|
||||
QVector<HighlightingMarkContainer> highlightingMarks_;
|
||||
QVector<SourceRangeContainer> skippedPreprocessorRanges_;
|
||||
};
|
||||
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
|
||||
void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingChangedMessage)
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H
|
||||
173
src/libs/clangbackendipc/highlightingmarkcontainer.cpp
Normal file
173
src/libs/clangbackendipc/highlightingmarkcontainer.cpp
Normal file
@@ -0,0 +1,173 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "highlightingmarkcontainer.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
HighlightingMarkContainer::HighlightingMarkContainer(uint line,
|
||||
uint column,
|
||||
uint length,
|
||||
HighlightingType type)
|
||||
: line_(line),
|
||||
column_(column),
|
||||
length_(length),
|
||||
type_(type)
|
||||
{
|
||||
}
|
||||
|
||||
uint HighlightingMarkContainer::line() const
|
||||
{
|
||||
return line_;
|
||||
}
|
||||
|
||||
uint HighlightingMarkContainer::column() const
|
||||
{
|
||||
return column_;
|
||||
}
|
||||
|
||||
uint HighlightingMarkContainer::length() const
|
||||
{
|
||||
return length_;
|
||||
}
|
||||
|
||||
HighlightingType HighlightingMarkContainer::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
quint32 &HighlightingMarkContainer::typeAsInt()
|
||||
{
|
||||
return reinterpret_cast<quint32&>(type_);
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container)
|
||||
{
|
||||
out << container.line_;
|
||||
out << container.column_;
|
||||
out << container.length_;
|
||||
out << quint32(container.type_);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container)
|
||||
{
|
||||
in >> container.line_;
|
||||
in >> container.column_;
|
||||
in >> container.length_;
|
||||
in >> container.typeAsInt();
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second)
|
||||
{
|
||||
return first.line_ == second.line_
|
||||
&& first.column_ == second.column_
|
||||
&& first.length_ == second.length_
|
||||
&& first.type_ == second.type_;
|
||||
}
|
||||
|
||||
bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second)
|
||||
{
|
||||
if (first.line() == second.line()) {
|
||||
if (first.column() == second.column()) {
|
||||
if (first.length() == second.length())
|
||||
return first.type() < second.type();
|
||||
return first.length() < second.length();
|
||||
}
|
||||
|
||||
return first.column() < second.column();
|
||||
}
|
||||
|
||||
return first.line() < second.line();
|
||||
}
|
||||
|
||||
#define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue
|
||||
static const char *highlightingTypeToCStringLiteral(HighlightingType type)
|
||||
{
|
||||
switch (type) {
|
||||
RETURN_TEXT_FOR_CASE(Invalid);
|
||||
RETURN_TEXT_FOR_CASE(Comment);
|
||||
RETURN_TEXT_FOR_CASE(Keyword);
|
||||
RETURN_TEXT_FOR_CASE(StringLiteral);
|
||||
RETURN_TEXT_FOR_CASE(NumberLiteral);
|
||||
RETURN_TEXT_FOR_CASE(Function);
|
||||
RETURN_TEXT_FOR_CASE(VirtualFunction);
|
||||
RETURN_TEXT_FOR_CASE(Type);
|
||||
RETURN_TEXT_FOR_CASE(LocalVariable);
|
||||
RETURN_TEXT_FOR_CASE(GlobalVariable);
|
||||
RETURN_TEXT_FOR_CASE(Field);
|
||||
RETURN_TEXT_FOR_CASE(Enumeration);
|
||||
RETURN_TEXT_FOR_CASE(Operator);
|
||||
RETURN_TEXT_FOR_CASE(Preprocessor);
|
||||
RETURN_TEXT_FOR_CASE(Label);
|
||||
RETURN_TEXT_FOR_CASE(OutputArgument);
|
||||
RETURN_TEXT_FOR_CASE(PreprocessorDefinition);
|
||||
RETURN_TEXT_FOR_CASE(PreprocessorExpansion);
|
||||
default: return "UnhandledHighlightingType";
|
||||
}
|
||||
}
|
||||
#undef RETURN_TEXT_FOR_CASE
|
||||
|
||||
QDebug operator<<(QDebug debug, const HighlightingMarkContainer &container)
|
||||
{
|
||||
debug.nospace() << "HighlightingMarkContainer("
|
||||
<< container.line() << ", "
|
||||
<< container.column() << ", "
|
||||
<< container.length() << ", "
|
||||
<< highlightingTypeToCStringLiteral(container.type()) << ", "
|
||||
<< ")";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
void PrintTo(HighlightingType highlightingType, std::ostream *os)
|
||||
{
|
||||
*os << highlightingTypeToCStringLiteral(highlightingType);
|
||||
}
|
||||
|
||||
void PrintTo(const HighlightingMarkContainer& container, ::std::ostream *os)
|
||||
{
|
||||
*os << "HighlightingMarkContainer("
|
||||
<< container.line() << ", "
|
||||
<< container.column() << ", "
|
||||
<< container.length() << ", ";
|
||||
PrintTo(container.type(), os);
|
||||
*os << ")";
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
79
src/libs/clangbackendipc/highlightingmarkcontainer.h
Normal file
79
src/libs/clangbackendipc/highlightingmarkcontainer.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
#define CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT HighlightingMarkContainer
|
||||
{
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container);
|
||||
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container);
|
||||
friend CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
|
||||
|
||||
public:
|
||||
HighlightingMarkContainer() = default;
|
||||
HighlightingMarkContainer(uint line, uint column, uint length, HighlightingType type);
|
||||
|
||||
uint line() const;
|
||||
uint column() const;
|
||||
uint length() const;
|
||||
HighlightingType type() const;
|
||||
|
||||
private:
|
||||
quint32 &typeAsInt();
|
||||
|
||||
private:
|
||||
uint line_;
|
||||
uint column_;
|
||||
uint length_;
|
||||
HighlightingType type_;
|
||||
};
|
||||
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container);
|
||||
CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
|
||||
CMBIPC_EXPORT bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingMarkContainer &container);
|
||||
CMBIPC_EXPORT void PrintTo(HighlightingType highlightingType, ::std::ostream *os);
|
||||
void PrintTo(const HighlightingMarkContainer &container, ::std::ostream *os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingMarkContainer)
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
@@ -80,5 +80,11 @@ void IpcClientDispatcher::diagnosticsChanged(const DiagnosticsChangedMessage &me
|
||||
client->diagnosticsChanged(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->highlightingChanged(message);
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) override;
|
||||
void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) override;
|
||||
void diagnosticsChanged(const DiagnosticsChangedMessage &message) override;
|
||||
void highlightingChanged(const HighlightingChangedMessage &message) override;
|
||||
|
||||
private:
|
||||
QVector<IpcClientInterface*> clients;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "translationunitdoesnotexistmessage.h"
|
||||
#include "diagnosticschangedmessage.h"
|
||||
#include "highlightingchangedmessage.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
@@ -50,6 +51,7 @@ void IpcClientInterface::dispatch(const QVariant &message)
|
||||
static const int translationUnitDoesNotExistMessage = QMetaType::type("ClangBackEnd::TranslationUnitDoesNotExistMessage");
|
||||
static const int projectPartsDoNotExistMessage = QMetaType::type("ClangBackEnd::ProjectPartsDoNotExistMessage");
|
||||
static const int diagnosticsChangedMessage = QMetaType::type("ClangBackEnd::DiagnosticsChangedMessage");
|
||||
static const int highlightingChangedMessage = QMetaType::type("ClangBackEnd::HighlightingChangedMessage");
|
||||
|
||||
int type = message.userType();
|
||||
|
||||
@@ -65,6 +67,8 @@ void IpcClientInterface::dispatch(const QVariant &message)
|
||||
projectPartsDoNotExist(message.value<ProjectPartsDoNotExistMessage>());
|
||||
else if (type == diagnosticsChangedMessage)
|
||||
diagnosticsChanged(message.value<DiagnosticsChangedMessage>());
|
||||
else if (type == highlightingChangedMessage)
|
||||
highlightingChanged(message.value<HighlightingChangedMessage>());
|
||||
else
|
||||
qWarning() << "Unknown IpcClientMessage";
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ class RequestDiagnosticsMessage;
|
||||
class RegisterUnsavedFilesForEditorMessage;
|
||||
class UnregisterUnsavedFilesForEditorMessage;
|
||||
class UpdateVisibleTranslationUnitsMessage;
|
||||
class RequestHighlightingMessage;
|
||||
class HighlightingChangedMessage;
|
||||
|
||||
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
|
||||
{
|
||||
@@ -63,6 +65,7 @@ public:
|
||||
virtual void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) = 0;
|
||||
virtual void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) = 0;
|
||||
virtual void diagnosticsChanged(const DiagnosticsChangedMessage &message) = 0;
|
||||
virtual void highlightingChanged(const HighlightingChangedMessage &message) = 0;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "cmbechomessage.h"
|
||||
#include "cmbregistertranslationunitsforeditormessage.h"
|
||||
#include "diagnosticschangedmessage.h"
|
||||
#include "highlightingchangedmessage.h"
|
||||
#include "ipcserverinterface.h"
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "translationunitdoesnotexistmessage.h"
|
||||
@@ -104,6 +105,11 @@ void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
}
|
||||
|
||||
void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
}
|
||||
|
||||
void IpcClientProxy::readMessages()
|
||||
{
|
||||
for (const QVariant &message : readMessageBlock.readAll())
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) override;
|
||||
void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) override;
|
||||
void diagnosticsChanged(const DiagnosticsChangedMessage &message) override;
|
||||
void highlightingChanged(const HighlightingChangedMessage &message) override;
|
||||
|
||||
void readMessages();
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "cmbunregistertranslationunitsforeditormessage.h"
|
||||
#include "registerunsavedfilesforeditormessage.h"
|
||||
#include "requestdiagnosticsmessage.h"
|
||||
#include "requesthighlightingmessage.h"
|
||||
#include "unregisterunsavedfilesforeditormessage.h"
|
||||
#include "updatetranslationunitsforeditormessage.h"
|
||||
#include "updatevisibletranslationunitsmessage.h"
|
||||
@@ -58,9 +59,9 @@ void IpcServerInterface::dispatch(const QVariant &message)
|
||||
static const int unregisterUnsavedFilesForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterUnsavedFilesForEditorMessage");
|
||||
static const int completeCodeMessageType = QMetaType::type("ClangBackEnd::CompleteCodeMessage");
|
||||
static const int requestDiagnosticsMessageType = QMetaType::type("ClangBackEnd::RequestDiagnosticsMessage");
|
||||
static const int requestHighlightingTypeMessage = QMetaType::type("ClangBackEnd::RequestHighlightingMessage");
|
||||
static const int updateVisibleTranslationUnitsMessageType = QMetaType::type("ClangBackEnd::UpdateVisibleTranslationUnitsMessage");
|
||||
|
||||
|
||||
int type = message.userType();
|
||||
|
||||
if (type == endMessageType)
|
||||
@@ -83,6 +84,8 @@ void IpcServerInterface::dispatch(const QVariant &message)
|
||||
completeCode(message.value<CompleteCodeMessage>());
|
||||
else if (type == requestDiagnosticsMessageType)
|
||||
requestDiagnostics(message.value<RequestDiagnosticsMessage>());
|
||||
else if (type == requestHighlightingTypeMessage)
|
||||
requestHighlighting(message.value<RequestHighlightingMessage>());
|
||||
else if (type == updateVisibleTranslationUnitsMessageType)
|
||||
updateVisibleTranslationUnits(message.value<UpdateVisibleTranslationUnitsMessage>());
|
||||
else
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
virtual void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) = 0;
|
||||
virtual void completeCode(const CompleteCodeMessage &message) = 0;
|
||||
virtual void requestDiagnostics(const RequestDiagnosticsMessage &message) = 0;
|
||||
virtual void requestHighlighting(const RequestHighlightingMessage &message) = 0;
|
||||
virtual void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) = 0;
|
||||
|
||||
void addClient(IpcClientInterface *client);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <ipcclientinterface.h>
|
||||
#include <registerunsavedfilesforeditormessage.h>
|
||||
#include <requestdiagnosticsmessage.h>
|
||||
#include <requesthighlightingmessage.h>
|
||||
#include <unregisterunsavedfilesforeditormessage.h>
|
||||
#include <updatetranslationunitsforeditormessage.h>
|
||||
#include <updatevisibletranslationunitsmessage.h>
|
||||
@@ -120,6 +121,11 @@ void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMe
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
}
|
||||
|
||||
void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
}
|
||||
|
||||
void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
|
||||
@@ -65,7 +65,9 @@ public:
|
||||
void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) override;
|
||||
void completeCode(const CompleteCodeMessage &message) override;
|
||||
void requestDiagnostics(const RequestDiagnosticsMessage &message) override;
|
||||
void requestHighlighting(const RequestHighlightingMessage &message) override;
|
||||
void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) override;
|
||||
|
||||
void readMessages();
|
||||
|
||||
void resetCounter();
|
||||
|
||||
89
src/libs/clangbackendipc/requesthighlightingmessage.cpp
Normal file
89
src/libs/clangbackendipc/requesthighlightingmessage.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "requesthighlightingmessage.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
RequestHighlightingMessage::RequestHighlightingMessage(const FileContainer &file)
|
||||
: fileContainer_(file)
|
||||
{
|
||||
}
|
||||
|
||||
const FileContainer RequestHighlightingMessage::fileContainer() const
|
||||
{
|
||||
return fileContainer_;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message)
|
||||
{
|
||||
out << message.fileContainer_;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message)
|
||||
{
|
||||
in >> message.fileContainer_;
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second)
|
||||
{
|
||||
return first.fileContainer_ == second.fileContainer_;
|
||||
}
|
||||
|
||||
bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second)
|
||||
{
|
||||
return first.fileContainer_ < second.fileContainer_;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message)
|
||||
{
|
||||
debug.nospace() << "RequestHighlightingMessage("
|
||||
<< message.fileContainer()
|
||||
<< ")";
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os)
|
||||
{
|
||||
*os << message.fileContainer().filePath().constData()
|
||||
<< "(" << message.fileContainer().projectPartId().constData() << ")";
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
69
src/libs/clangbackendipc/requesthighlightingmessage.h
Normal file
69
src/libs/clangbackendipc/requesthighlightingmessage.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms and
|
||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CLANGBACKEND_REQUESTHIGHLIGHTING_H
|
||||
#define CLANGBACKEND_REQUESTHIGHLIGHTING_H
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT RequestHighlightingMessage
|
||||
{
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message);
|
||||
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
|
||||
friend void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os);
|
||||
|
||||
public:
|
||||
RequestHighlightingMessage() = default;
|
||||
RequestHighlightingMessage(const FileContainer &fileContainer);
|
||||
|
||||
const FileContainer fileContainer() const;
|
||||
|
||||
private:
|
||||
FileContainer fileContainer_;
|
||||
};
|
||||
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
|
||||
void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RequestHighlightingMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REQUESTHIGHLIGHTING_H
|
||||
Reference in New Issue
Block a user