Merge remote-tracking branch 'origin/4.7'

Change-Id: Ib288796892faf5345d2a150a5ce0dadf91552924
This commit is contained in:
Eike Ziller
2018-06-04 16:33:03 +02:00
193 changed files with 2196 additions and 1542 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -72,6 +72,9 @@
\li In the \uicontrol Path field, specify the path to the CMake \li In the \uicontrol Path field, specify the path to the CMake
executable. executable.
\li Select the \uicontrol {Auto-create build directories} check box to
automatically create build directories for CMake projects.
\li Select \uicontrol Apply to save your changes. \li Select \uicontrol Apply to save your changes.
\endlist \endlist
@@ -83,7 +86,7 @@
is. is.
Select the \uicontrol Kits tab to add the CMake tool to a build and run kit. Select the \uicontrol Kits tab to add the CMake tool to a build and run kit.
The kit also specifies the CMake Generator that is used for producing The kit also specifies the CMake generator that is used for producing
project files for \QC and the configuration variables that are used: project files for \QC and the configuration variables that are used:
\image qtcreator-kits.png \image qtcreator-kits.png

View File

@@ -95,6 +95,7 @@
\li Diagnostics \li Diagnostics
\li Clang-Tidy checks \li Clang-Tidy checks
\li Clazy checks \li Clazy checks
\li Outline of symbols
\li Tooltips \li Tooltips
\li Renaming of local symbols \li Renaming of local symbols

View File

@@ -1268,6 +1268,7 @@
\li \c :substitute substitutes an expression in a range \li \c :substitute substitutes an expression in a range
\li \c :'<,'>!cmd filters through an external command (for example, \li \c :'<,'>!cmd filters through an external command (for example,
sorts the lines in a file with \c :%!sort) sorts the lines in a file with \c :%!sort)
\li \c :<range>sor[t][!]
\li \c :.!cmd inserts the standard output of an external command \li \c :.!cmd inserts the standard output of an external command
\li \c :read \li \c :read
\li \c :yank, \c :delete, \c :change \li \c :yank, \c :delete, \c :change

View File

@@ -403,6 +403,10 @@
\li \uicontrol {Build System} - Errors and warnings encountered during a \li \uicontrol {Build System} - Errors and warnings encountered during a
build. build.
\li \uicontrol {Clang Code Model} -
\l {Parsing C++ Files with the Clang Code Model}
{Errors and warnings from the current editor}.
\li \uicontrol Compile - Selected output from the compiler. Open the \li \uicontrol Compile - Selected output from the compiler. Open the
\uicontrol {Compile Output} pane for more detailed information. \uicontrol {Compile Output} pane for more detailed information.
@@ -422,6 +426,8 @@
by \l{Showing Task List Files in Issues Pane} by \l{Showing Task List Files in Issues Pane}
{code scanning and analysis tools}. {code scanning and analysis tools}.
\li \uicontrol Python - Runtime errors and exceptions of Python scripts.
\li \uicontrol QML - Errors in QML syntax. \li \uicontrol QML - Errors in QML syntax.
\li \uicontrol {QML Analysis} - Results of the JavaScript \li \uicontrol {QML Analysis} - Results of the JavaScript

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -39,72 +39,6 @@
\section1 General Questions \section1 General Questions
\b {\QC only shows a blank window, a dialog complaining about missing OpenGL support, or crashes on startup. What's going wrong?}
Some parts of \QC use Qt Quick 2, which relies on OpenGL API for
drawing. The most prominent use of Qt Quick 2 is in the Welcome mode, but it's
also used for the \QMLD, and the QML Profiler.
Unfortunately the use of OpenGL can cause problems, especially in remote setups
and with outdated drivers. You can quickly check whether this is your problem by:
\list
\li Launching \QC with Welcome mode disabled ( \c{-noload Welcome} on
command line).
\li Checking the console or the Windows debugger log for OpenGL-related error messages.
\endlist
The fixes and workarounds differ, depending on your setup. As a last resort you
can disable the affected plugins.
\e{Virtual Machines}
Try to enable \e{3D acceleration} in your virtual machine's settings. For VirtualBox,
also make sure you have installed the Guest Addons, including experimental
\e{Direct3D support}.
\e{Windows}
Check whether \QC has been compiled with OpenGL/Desktop, or ANGLE as
a backend. The official binaries are always built with ANGLE (a library that
maps OpenGL ES API to DirectX).
\list
\li ANGLE backend: This requires a Windows version newer than Windows XP. If you
have problems, try updating your graphics drivers or update your
DirectX version. Run \c dxdiag.exe to check whether \e{Direct3D Acceleration}
is indeed enabled.
\li OpenGL backend: Make sure your graphics driver supports OpenGL 2.1 or newer.
Try to update your graphics driver.
\endlist
\e{Unix}
Run \c glxgears for a quick check whether OpenGL works in general. Check output of
\c glxinfo to get more details like the OpenGL driver and renderer (search for 'OpenGL'
in the application's output).
If you are using the Mesa driver, you can force OpenGL to be rendered in software
by setting the \c LIBGL_ALWAYS_SOFTWARE environment variable.
\e{Disabling plugins}
You can disable the \QC plugins, at the expense of losing functionality:
\list
\li Launch \QC from command line, with
\c {-noload Welcome -noload QmlProfiler -noload QuickDesigner} arguments.
\li Disable the plugins permanently by selecting \uicontrol Help > \uicontrol{About Plugins}.
\endlist
\b {How do I reset all \QC settings?} \b {How do I reset all \QC settings?}
@@ -143,6 +77,89 @@
\include widgets/creator-faq-qtdesigner.qdocinc qt designer faq \include widgets/creator-faq-qtdesigner.qdocinc qt designer faq
\section1 QML and Qt Quick Questions
\b {Why is there a red line below my QML import, even though I have the module?}
By default, \QC looks in the QML import path of Qt for QML modules.
Sometimes, it does not get it right and you need to tell it where the
modules are by specifying the \c{QML_IMPORT_PATH} in the \c{.pro} file of
your application.
This also enables code completion of QML code and removes error messages.
The following example illustrates how to specify the import path so that
it works when switching between build and run kits for different target
platforms:
\code
TEMPNAME = $${QMAKE_QMAKE}
MY_QTPATH = $$dirname(TEMPNAME)
QML_IMPORT_PATH += $$MY_QTPATH/../qml
message("my QML Import Path: "$$QML_IMPORT_PATH)
\endcode
For more information about how to set the import path when using CMake, see
\l {Importing QML Modules}.
\b {What should I do when \QC complains about missing OpenGL support?}
Some parts of \QC, such as \QMLD and QML Profiler, use Qt Quick 2, which
relies on OpenGL API for drawing. Unfortunately, the use of OpenGL can cause
problems, especially in remote setups and with outdated drivers. In these
cases, \QC displays OpenGL-related error messages on the console or records
them in the Windows debugger log.
The fixes and workarounds differ, depending on your setup. As a last resort,
you can disable the affected plugins.
\e{Virtual Machines}
Try to enable \e{3D acceleration} in your virtual machine's settings. For
VirtualBox, also make sure you have installed the Guest Addons, including
experimental \e{Direct3D support}.
\e{Windows}
Check whether \QC has been compiled with OpenGL/Desktop, or ANGLE as
a backend. The official binaries are always built with ANGLE (a library that
maps OpenGL ES API to DirectX).
\list
\li ANGLE backend: This requires a Windows version newer than Windows XP.
If you have problems, try updating your graphics drivers or update
your DirectX version. Run \c dxdiag.exe to check whether
\e{Direct3D Acceleration} is indeed enabled.
\li OpenGL backend: Make sure your graphics driver supports OpenGL 2.1 or
newer. Try to update your graphics driver.
\endlist
\e{Unix}
Run \c glxgears for a quick check whether OpenGL works in general. Check the
output of \c glxinfo to get more details like the OpenGL driver and renderer
(search for \e OpenGL in the application's output).
If you are using the Mesa driver, you can force OpenGL to be rendered in
software by setting the \c LIBGL_ALWAYS_SOFTWARE environment variable.
\e{Disabling plugins}
You can disable the \QC plugins, at the expense of losing functionality:
\list
\li Launch \QC from command line, with the
\c {-noload QmlProfiler -noload QuickDesigner} arguments.
\li Disable the plugins permanently by selecting \uicontrol Help >
\uicontrol{About Plugins}.
\endlist
\section1 Help Questions \section1 Help Questions
\b {The Qt API Reference Documentation is missing and context help does \b {The Qt API Reference Documentation is missing and context help does

View File

@@ -67,6 +67,10 @@
\endlist \endlist
While the application is being built, the \uicontrol Build button changes to
a \uicontrol {Cancel Build} button (3). To cancel the build, select the
button or press \key {Alt+Backspace}.
For more information on the options you have, see For more information on the options you have, see
\l{Specifying Build Settings}. \l{Specifying Build Settings}.

View File

@@ -74,7 +74,15 @@
To clone the selected kit, select \uicontrol Clone. To clone the selected kit, select \uicontrol Clone.
\li In the \uicontrol Name column, double-click the kit name to change it. \li In the \uicontrol Name column, enter a name for the kit.
\li Select the \inlineimage qtcreator-desktopdevice-button.png
button to select an image to use as an icon for the kit.
\li In the \uicontrol {File system name} field, enter a name for the kit
to use as a part of directory names. This value is used for the
\e CurrentKit:FileSystemName variable, which determines the name of
the shadow build directory, for example.
\li In the \uicontrol{Device type} field, select the type of the device. \li In the \uicontrol{Device type} field, select the type of the device.
@@ -101,6 +109,11 @@
the \uicontrol {Edit Environment Changes} dialog. For more information the \uicontrol {Edit Environment Changes} dialog. For more information
about how to add and remove variable values, see \l{Batch Editing}. about how to add and remove variable values, see \l{Batch Editing}.
\li Select the \uicontrol {Force UTF-8 MSVC compiler output} check box
to either switch the language of MSVC to English or to keep the
language setting and just force UTF-8 output, depending on the
MSVC compiler used.
\li In the \uicontrol Debugger field, select the debugger to debug the project \li In the \uicontrol Debugger field, select the debugger to debug the project
on the target platform. \QC automatically detects available on the target platform. \QC automatically detects available
debuggers and displays a suitable debugger in the field. You can debuggers and displays a suitable debugger in the field. You can

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbalivemessage.h" #include "alivemessage.h"
#include <QDebug> #include <QDebug>
@@ -34,4 +34,4 @@ QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
return debug.nospace() << "AliveMessage()"; return debug.nospace() << "AliveMessage()";
} }
} } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "documentannotationschangedmessage.h" #include "annotationsmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const DocumentAnnotationsChangedMessage &message) QDebug operator<<(QDebug debug, const AnnotationsMessage &message)
{ {
debug.nospace() << "DocumentAnnotationsChangedMessage(" debug.nospace() << "AnnotationsMessage("
<< message.fileContainer << message.fileContainer
<< ", " << message.diagnostics.size() << ", " << message.diagnostics.size()
<< ", " << !message.firstHeaderErrorDiagnostic.text.isEmpty() << ", " << !message.firstHeaderErrorDiagnostic.text.isEmpty()

View File

@@ -35,32 +35,32 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT DocumentAnnotationsChangedMessage class CLANGSUPPORT_EXPORT AnnotationsMessage
{ {
public: public:
DocumentAnnotationsChangedMessage() = default; AnnotationsMessage() = default;
// For pure token infos update // For pure token infos update
DocumentAnnotationsChangedMessage(const FileContainer &fileContainer, AnnotationsMessage(const FileContainer &fileContainer,
const QVector<TokenInfoContainer> &tokenInfos) const QVector<TokenInfoContainer> &tokenInfos)
: fileContainer(fileContainer), : fileContainer(fileContainer),
tokenInfos(tokenInfos), tokenInfos(tokenInfos),
onlyTokenInfos(true) onlyTokenInfos(true)
{ {
} }
DocumentAnnotationsChangedMessage(const FileContainer &fileContainer, AnnotationsMessage(const FileContainer &fileContainer,
const QVector<DiagnosticContainer> &diagnostics, const QVector<DiagnosticContainer> &diagnostics,
const DiagnosticContainer &firstHeaderErrorDiagnostic, const DiagnosticContainer &firstHeaderErrorDiagnostic,
const QVector<TokenInfoContainer> &tokenInfos, const QVector<TokenInfoContainer> &tokenInfos,
const QVector<SourceRangeContainer> &skippedPreprocessorRanges) const QVector<SourceRangeContainer> &skippedPreprocessorRanges)
: fileContainer(fileContainer), : fileContainer(fileContainer)
tokenInfos(tokenInfos), , tokenInfos(tokenInfos)
diagnostics(diagnostics), , diagnostics(diagnostics)
firstHeaderErrorDiagnostic(firstHeaderErrorDiagnostic), , firstHeaderErrorDiagnostic(firstHeaderErrorDiagnostic)
skippedPreprocessorRanges(skippedPreprocessorRanges) , skippedPreprocessorRanges(skippedPreprocessorRanges)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const DocumentAnnotationsChangedMessage &message) friend QDataStream &operator<<(QDataStream &out, const AnnotationsMessage &message)
{ {
out << message.onlyTokenInfos; out << message.onlyTokenInfos;
out << message.fileContainer; out << message.fileContainer;
@@ -74,7 +74,7 @@ public:
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, DocumentAnnotationsChangedMessage &message) friend QDataStream &operator>>(QDataStream &in, AnnotationsMessage &message)
{ {
in >> message.onlyTokenInfos; in >> message.onlyTokenInfos;
in >> message.fileContainer; in >> message.fileContainer;
@@ -88,8 +88,7 @@ public:
return in; return in;
} }
friend bool operator==(const DocumentAnnotationsChangedMessage &first, friend bool operator==(const AnnotationsMessage &first, const AnnotationsMessage &second)
const DocumentAnnotationsChangedMessage &second)
{ {
return first.fileContainer == second.fileContainer return first.fileContainer == second.fileContainer
&& first.diagnostics == second.diagnostics && first.diagnostics == second.diagnostics
@@ -107,7 +106,7 @@ public:
bool onlyTokenInfos = false; bool onlyTokenInfos = false;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentAnnotationsChangedMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const AnnotationsMessage &message);
DECLARE_MESSAGE(DocumentAnnotationsChangedMessage) DECLARE_MESSAGE(AnnotationsMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -41,11 +41,11 @@ void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelo
case MessageType::EchoMessage: case MessageType::EchoMessage:
echo(messageEnvelop.message<EchoMessage>()); echo(messageEnvelop.message<EchoMessage>());
break; break;
case MessageType::CodeCompletedMessage: case MessageType::CompletionsMessage:
codeCompleted(messageEnvelop.message<CodeCompletedMessage>()); completions(messageEnvelop.message<CompletionsMessage>());
break; break;
case MessageType::DocumentAnnotationsChangedMessage: case MessageType::AnnotationsMessage:
documentAnnotationsChanged(messageEnvelop.message<DocumentAnnotationsChangedMessage>()); annotations(messageEnvelop.message<AnnotationsMessage>());
break; break;
case MessageType::ReferencesMessage: case MessageType::ReferencesMessage:
references(messageEnvelop.message<ReferencesMessage>()); references(messageEnvelop.message<ReferencesMessage>());

View File

@@ -31,25 +31,25 @@ namespace ClangBackEnd {
class ClangCodeModelServerInterface; class ClangCodeModelServerInterface;
class CodeCompletedMessage; class AnnotationsMessage;
class CompleteCodeMessage; class CompletionsMessage;
class DocumentAnnotationsChangedMessage; class DocumentVisibilityChangedMessage;
class DocumentsChangedMessage;
class DocumentsClosedMessage;
class DocumentsOpenedMessage;
class EchoMessage; class EchoMessage;
class ReferencesMessage;
class FollowSymbolMessage; class FollowSymbolMessage;
class RegisterProjectPartsForEditorMessage; class ProjectPartsRemovedMessage;
class RegisterTranslationUnitForEditorMessage; class ProjectPartsUpdatedMessage;
class RegisterUnsavedFilesForEditorMessage; class ReferencesMessage;
class RequestDocumentAnnotationsMessage; class RequestAnnotationsMessage;
class RequestReferencesMessage; class RequestCompletionsMessage;
class RequestFollowSymbolMessage; class RequestFollowSymbolMessage;
class RequestReferencesMessage;
class RequestToolTipMessage; class RequestToolTipMessage;
class ToolTipMessage; class ToolTipMessage;
class UnregisterProjectPartsForEditorMessage; class UnsavedFilesRemovedMessage;
class UnregisterTranslationUnitsForEditorMessage; class UnsavedFilesUpdatedMessage;
class UnregisterUnsavedFilesForEditorMessage;
class UpdateTranslationUnitsForEditorMessage;
class UpdateVisibleTranslationUnitsMessage;
class CLANGSUPPORT_EXPORT ClangCodeModelClientInterface : public IpcClientInterface class CLANGSUPPORT_EXPORT ClangCodeModelClientInterface : public IpcClientInterface
{ {
@@ -58,8 +58,8 @@ public:
virtual void alive() = 0; virtual void alive() = 0;
virtual void echo(const EchoMessage &message) = 0; virtual void echo(const EchoMessage &message) = 0;
virtual void codeCompleted(const CodeCompletedMessage &message) = 0; virtual void completions(const CompletionsMessage &message) = 0;
virtual void documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) = 0; virtual void annotations(const AnnotationsMessage &message) = 0;
virtual void references(const ReferencesMessage &message) = 0; virtual void references(const ReferencesMessage &message) = 0;
virtual void followSymbol(const FollowSymbolMessage &message) = 0; virtual void followSymbol(const FollowSymbolMessage &message) = 0;
virtual void tooltip(const ToolTipMessage &message) = 0; virtual void tooltip(const ToolTipMessage &message) = 0;

View File

@@ -25,10 +25,10 @@
#pragma once #pragma once
#include "cmbalivemessage.h" #include "alivemessage.h"
#include "cmbcodecompletedmessage.h" #include "completionsmessage.h"
#include "cmbechomessage.h" #include "echomessage.h"
#include "documentannotationschangedmessage.h" #include "annotationsmessage.h"
#include "referencesmessage.h" #include "referencesmessage.h"
#include "followsymbolmessage.h" #include "followsymbolmessage.h"
#include "tooltipmessage.h" #include "tooltipmessage.h"

View File

@@ -75,12 +75,12 @@ void ClangCodeModelClientProxy::echo(const EchoMessage &message)
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelClientProxy::codeCompleted(const CodeCompletedMessage &message) void ClangCodeModelClientProxy::completions(const CompletionsMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelClientProxy::documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) void ClangCodeModelClientProxy::annotations(const AnnotationsMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }

View File

@@ -53,8 +53,8 @@ public:
void alive() override; void alive() override;
void echo(const EchoMessage &message) override; void echo(const EchoMessage &message) override;
void codeCompleted(const CodeCompletedMessage &message) override; void completions(const CompletionsMessage &message) override;
void documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) override; void annotations(const AnnotationsMessage &message) override;
void references(const ReferencesMessage &message) override; void references(const ReferencesMessage &message) override;
void followSymbol(const FollowSymbolMessage &message) override; void followSymbol(const FollowSymbolMessage &message) override;
void tooltip(const ToolTipMessage &message) override; void tooltip(const ToolTipMessage &message) override;

View File

@@ -38,32 +38,35 @@ void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelo
case MessageType::EndMessage: case MessageType::EndMessage:
end(); end();
break; break;
case MessageType::RegisterTranslationUnitForEditorMessage: case MessageType::DocumentsOpenedMessage:
registerTranslationUnitsForEditor(messageEnvelop.message<RegisterTranslationUnitForEditorMessage>()); documentsOpened(messageEnvelop.message<DocumentsOpenedMessage>());
break; break;
case MessageType::UpdateTranslationUnitsForEditorMessage: case MessageType::DocumentsChangedMessage:
updateTranslationUnitsForEditor(messageEnvelop.message<UpdateTranslationUnitsForEditorMessage>()); documentsChanged(messageEnvelop.message<DocumentsChangedMessage>());
break; break;
case MessageType::UnregisterTranslationUnitsForEditorMessage: case MessageType::DocumentsClosedMessage:
unregisterTranslationUnitsForEditor(messageEnvelop.message<UnregisterTranslationUnitsForEditorMessage>()); documentsClosed(messageEnvelop.message<DocumentsClosedMessage>());
break; break;
case MessageType::RegisterProjectPartsForEditorMessage: case MessageType::DocumentVisibilityChangedMessage:
registerProjectPartsForEditor(messageEnvelop.message<RegisterProjectPartsForEditorMessage>()); documentVisibilityChanged(messageEnvelop.message<DocumentVisibilityChangedMessage>());
break; break;
case MessageType::UnregisterProjectPartsForEditorMessage: case MessageType::ProjectPartsUpdatedMessage:
unregisterProjectPartsForEditor(messageEnvelop.message<UnregisterProjectPartsForEditorMessage>()); projectPartsUpdated(messageEnvelop.message<ProjectPartsUpdatedMessage>());
break; break;
case MessageType::RegisterUnsavedFilesForEditorMessage: case MessageType::ProjectPartsRemovedMessage:
registerUnsavedFilesForEditor(messageEnvelop.message<RegisterUnsavedFilesForEditorMessage>()); projectPartsRemoved(messageEnvelop.message<ProjectPartsRemovedMessage>());
break; break;
case MessageType::UnregisterUnsavedFilesForEditorMessage: case MessageType::UnsavedFilesUpdatedMessage:
unregisterUnsavedFilesForEditor(messageEnvelop.message<UnregisterUnsavedFilesForEditorMessage>()); unsavedFilesUpdated(messageEnvelop.message<UnsavedFilesUpdatedMessage>());
break; break;
case MessageType::CompleteCodeMessage: case MessageType::UnsavedFilesRemovedMessage:
completeCode(messageEnvelop.message<CompleteCodeMessage>()); unsavedFilesRemoved(messageEnvelop.message<UnsavedFilesRemovedMessage>());
break; break;
case MessageType::RequestDocumentAnnotationsMessage: case MessageType::RequestCompletionsMessage:
requestDocumentAnnotations(messageEnvelop.message<RequestDocumentAnnotationsMessage>()); requestCompletions(messageEnvelop.message<RequestCompletionsMessage>());
break;
case MessageType::RequestAnnotationsMessage:
requestAnnotations(messageEnvelop.message<RequestAnnotationsMessage>());
break; break;
case MessageType::RequestReferencesMessage: case MessageType::RequestReferencesMessage:
requestReferences(messageEnvelop.message<RequestReferencesMessage>()); requestReferences(messageEnvelop.message<RequestReferencesMessage>());
@@ -74,9 +77,6 @@ void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelo
case MessageType::RequestToolTipMessage: case MessageType::RequestToolTipMessage:
requestToolTip(messageEnvelop.message<RequestToolTipMessage>()); requestToolTip(messageEnvelop.message<RequestToolTipMessage>());
break; break;
case MessageType::UpdateVisibleTranslationUnitsMessage:
updateVisibleTranslationUnits(messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>());
break;
default: default:
qWarning() << "Unknown ClangCodeModelServerMessage"; qWarning() << "Unknown ClangCodeModelServerMessage";
} }

View File

@@ -41,19 +41,23 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override; void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0; virtual void end() = 0;
virtual void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) = 0;
virtual void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) = 0; virtual void documentsOpened(const DocumentsOpenedMessage &message) = 0;
virtual void unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) = 0; virtual void documentsChanged(const DocumentsChangedMessage &message) = 0;
virtual void registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) = 0; virtual void documentsClosed(const DocumentsClosedMessage &message) = 0;
virtual void unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) = 0; virtual void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) = 0;
virtual void registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) = 0;
virtual void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) = 0; virtual void projectPartsUpdated(const ProjectPartsUpdatedMessage &message) = 0;
virtual void completeCode(const CompleteCodeMessage &message) = 0; virtual void projectPartsRemoved(const ProjectPartsRemovedMessage &message) = 0;
virtual void requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) = 0;
virtual void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) = 0;
virtual void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) = 0;
virtual void requestCompletions(const RequestCompletionsMessage &message) = 0;
virtual void requestAnnotations(const RequestAnnotationsMessage &message) = 0;
virtual void requestReferences(const RequestReferencesMessage &message) = 0; virtual void requestReferences(const RequestReferencesMessage &message) = 0;
virtual void requestFollowSymbol(const RequestFollowSymbolMessage &message) = 0; virtual void requestFollowSymbol(const RequestFollowSymbolMessage &message) = 0;
virtual void requestToolTip(const RequestToolTipMessage &message) = 0; virtual void requestToolTip(const RequestToolTipMessage &message) = 0;
virtual void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) = 0;
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -25,18 +25,22 @@
#pragma once #pragma once
#include "cmbechomessage.h" #include "echomessage.h"
#include "cmbcompletecodemessage.h" #include "endmessage.h"
#include "cmbendmessage.h"
#include "cmbregisterprojectsforeditormessage.h" #include "documentsopenedmessage.h"
#include "cmbregistertranslationunitsforeditormessage.h" #include "documentsclosedmessage.h"
#include "cmbunregisterprojectsforeditormessage.h" #include "documentschangedmessage.h"
#include "cmbunregistertranslationunitsforeditormessage.h" #include "documentvisibilitychangedmessage.h"
#include "registerunsavedfilesforeditormessage.h"
#include "requestdocumentannotations.h" #include "projectpartsupdatedmessage.h"
#include "requestreferencesmessage.h" #include "projectpartsremovedmessage.h"
#include "unsavedfilesupdatedmessage.h"
#include "unsavedfilesremovedmessage.h"
#include "requestannotationsmessage.h"
#include "requestcompletionsmessage.h"
#include "requestfollowsymbolmessage.h" #include "requestfollowsymbolmessage.h"
#include "requestreferencesmessage.h"
#include "requesttooltipmessage.h" #include "requesttooltipmessage.h"
#include "unregisterunsavedfilesforeditormessage.h"
#include "updatetranslationunitsforeditormessage.h"
#include "updatevisibletranslationunitsmessage.h"

View File

@@ -31,7 +31,8 @@
namespace ClangBackEnd { namespace ClangBackEnd {
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice) ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client,
QIODevice *ioDevice)
: BaseServerProxy(client, ioDevice) : BaseServerProxy(client, ioDevice)
{ {
} }
@@ -41,47 +42,47 @@ void ClangCodeModelServerProxy::end()
m_writeMessageBlock.write(EndMessage()); m_writeMessageBlock.write(EndMessage());
} }
void ClangCodeModelServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) void ClangCodeModelServerProxy::documentsOpened(const DocumentsOpenedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message) void ClangCodeModelServerProxy::documentsChanged(const DocumentsChangedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) void ClangCodeModelServerProxy::documentsClosed(const DocumentsClosedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) void ClangCodeModelServerProxy::projectPartsUpdated(const ProjectPartsUpdatedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) void ClangCodeModelServerProxy::projectPartsRemoved(const ProjectPartsRemovedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangBackEnd::ClangCodeModelServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message) void ClangCodeModelServerProxy::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangBackEnd::ClangCodeModelServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message) void ClangCodeModelServerProxy::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::completeCode(const CompleteCodeMessage &message) void ClangCodeModelServerProxy::requestCompletions(const RequestCompletionsMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) void ClangCodeModelServerProxy::requestAnnotations(const RequestAnnotationsMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
@@ -101,7 +102,8 @@ void ClangCodeModelServerProxy::requestToolTip(const RequestToolTipMessage &mess
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }
void ClangCodeModelServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) void ClangCodeModelServerProxy::documentVisibilityChanged(
const DocumentVisibilityChangedMessage &message)
{ {
m_writeMessageBlock.write(message); m_writeMessageBlock.write(message);
} }

View File

@@ -49,19 +49,23 @@ public:
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice); ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
void end() override; void end() override;
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;
void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) override; void documentsOpened(const DocumentsOpenedMessage &message) override;
void unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) override; void documentsChanged(const DocumentsChangedMessage &message) override;
void registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) override; void documentsClosed(const DocumentsClosedMessage &message) override;
void unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) override; void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) override;
void registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) override;
void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) override; void projectPartsUpdated(const ProjectPartsUpdatedMessage &message) override;
void completeCode(const CompleteCodeMessage &message) override; void projectPartsRemoved(const ProjectPartsRemovedMessage &message) override;
void requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) override;
void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) override;
void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) override;
void requestCompletions(const RequestCompletionsMessage &message) override;
void requestAnnotations(const RequestAnnotationsMessage &message) override;
void requestReferences(const RequestReferencesMessage &message) override; void requestReferences(const RequestReferencesMessage &message) override;
void requestFollowSymbol(const RequestFollowSymbolMessage &message) override; void requestFollowSymbol(const RequestFollowSymbolMessage &message) override;
void requestToolTip(const RequestToolTipMessage &message) override; void requestToolTip(const RequestToolTipMessage &message) override;
void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) override;
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -28,4 +28,4 @@
#include "sourcelocationsforrenamingmessage.h" #include "sourcelocationsforrenamingmessage.h"
#include "sourcerangesanddiagnosticsforquerymessage.h" #include "sourcerangesanddiagnosticsforquerymessage.h"
#include "sourcerangesforquerymessage.h" #include "sourcerangesforquerymessage.h"
#include "cmbalivemessage.h" #include "alivemessage.h"

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include "cancelmessage.h" #include "cancelmessage.h"
#include "cmbendmessage.h" #include "endmessage.h"
#include "requestsourcelocationforrenamingmessage.h" #include "requestsourcelocationforrenamingmessage.h"
#include "requestsourcerangesanddiagnosticsforquerymessage.h" #include "requestsourcerangesanddiagnosticsforquerymessage.h"
#include "requestsourcerangesforquerymessage.h" #include "requestsourcerangesforquerymessage.h"

View File

@@ -16,21 +16,21 @@ SOURCES += \
$$PWD/clangcodemodelconnectionclient.cpp \ $$PWD/clangcodemodelconnectionclient.cpp \
$$PWD/clangcodemodelserverinterface.cpp \ $$PWD/clangcodemodelserverinterface.cpp \
$$PWD/clangcodemodelserverproxy.cpp \ $$PWD/clangcodemodelserverproxy.cpp \
$$PWD/cmbalivemessage.cpp \ $$PWD/alivemessage.cpp \
$$PWD/cmbcodecompletedmessage.cpp \ $$PWD/completionsmessage.cpp \
$$PWD/cmbcompletecodemessage.cpp \ $$PWD/requestcompletionsmessage.cpp \
$$PWD/cmbechomessage.cpp \ $$PWD/echomessage.cpp \
$$PWD/cmbendmessage.cpp \ $$PWD/endmessage.cpp \
$$PWD/cmbregisterprojectsforeditormessage.cpp \ $$PWD/projectpartsupdatedmessage.cpp \
$$PWD/cmbregistertranslationunitsforeditormessage.cpp \ $$PWD/documentsopenedmessage.cpp \
$$PWD/cmbunregisterprojectsforeditormessage.cpp \ $$PWD/projectpartsremovedmessage.cpp \
$$PWD/cmbunregistertranslationunitsforeditormessage.cpp \ $$PWD/documentsclosedmessage.cpp \
$$PWD/codecompletionchunk.cpp \ $$PWD/codecompletionchunk.cpp \
$$PWD/codecompletion.cpp \ $$PWD/codecompletion.cpp \
$$PWD/connectionclient.cpp \ $$PWD/connectionclient.cpp \
$$PWD/connectionserver.cpp \ $$PWD/connectionserver.cpp \
$$PWD/diagnosticcontainer.cpp \ $$PWD/diagnosticcontainer.cpp \
$$PWD/documentannotationschangedmessage.cpp \ $$PWD/annotationsmessage.cpp \
$$PWD/dynamicastmatcherdiagnosticcontainer.cpp \ $$PWD/dynamicastmatcherdiagnosticcontainer.cpp \
$$PWD/dynamicastmatcherdiagnosticcontextcontainer.cpp \ $$PWD/dynamicastmatcherdiagnosticcontextcontainer.cpp \
$$PWD/dynamicastmatcherdiagnosticmessagecontainer.cpp \ $$PWD/dynamicastmatcherdiagnosticmessagecontainer.cpp \
@@ -55,9 +55,9 @@ SOURCES += \
$$PWD/refactoringserverinterface.cpp \ $$PWD/refactoringserverinterface.cpp \
$$PWD/refactoringserverproxy.cpp \ $$PWD/refactoringserverproxy.cpp \
$$PWD/referencesmessage.cpp \ $$PWD/referencesmessage.cpp \
$$PWD/registerunsavedfilesforeditormessage.cpp \ $$PWD/unsavedfilesupdatedmessage.cpp \
$$PWD/removeprojectpartsmessage.cpp \ $$PWD/removeprojectpartsmessage.cpp \
$$PWD/requestdocumentannotations.cpp \ $$PWD/requestannotationsmessage.cpp \
$$PWD/requestfollowsymbolmessage.cpp \ $$PWD/requestfollowsymbolmessage.cpp \
$$PWD/requestreferencesmessage.cpp \ $$PWD/requestreferencesmessage.cpp \
$$PWD/requestsourcelocationforrenamingmessage.cpp \ $$PWD/requestsourcelocationforrenamingmessage.cpp \
@@ -80,10 +80,10 @@ SOURCES += \
$$PWD/tokeninfocontainer.cpp \ $$PWD/tokeninfocontainer.cpp \
$$PWD/tooltipmessage.cpp \ $$PWD/tooltipmessage.cpp \
$$PWD/tooltipinfo.cpp \ $$PWD/tooltipinfo.cpp \
$$PWD/unregisterunsavedfilesforeditormessage.cpp \ $$PWD/unsavedfilesremovedmessage.cpp \
$$PWD/updateprojectpartsmessage.cpp \ $$PWD/updateprojectpartsmessage.cpp \
$$PWD/updatetranslationunitsforeditormessage.cpp \ $$PWD/documentschangedmessage.cpp \
$$PWD/updatevisibletranslationunitsmessage.cpp \ $$PWD/documentvisibilitychangedmessage.cpp \
$$PWD/writemessageblock.cpp \ $$PWD/writemessageblock.cpp \
$$PWD/filepathcaching.cpp \ $$PWD/filepathcaching.cpp \
$$PWD/filepathid.cpp \ $$PWD/filepathid.cpp \
@@ -106,21 +106,21 @@ HEADERS += \
$$PWD/clangrefactoringclientmessages.h \ $$PWD/clangrefactoringclientmessages.h \
$$PWD/clangrefactoringmessages.h \ $$PWD/clangrefactoringmessages.h \
$$PWD/clangrefactoringservermessages.h \ $$PWD/clangrefactoringservermessages.h \
$$PWD/cmbalivemessage.h \ $$PWD/alivemessage.h \
$$PWD/cmbcodecompletedmessage.h \ $$PWD/completionsmessage.h \
$$PWD/cmbcompletecodemessage.h \ $$PWD/requestcompletionsmessage.h \
$$PWD/cmbechomessage.h \ $$PWD/echomessage.h \
$$PWD/cmbendmessage.h \ $$PWD/endmessage.h \
$$PWD/cmbregisterprojectsforeditormessage.h \ $$PWD/projectpartsupdatedmessage.h \
$$PWD/cmbregistertranslationunitsforeditormessage.h \ $$PWD/documentsopenedmessage.h \
$$PWD/cmbunregisterprojectsforeditormessage.h \ $$PWD/projectpartsremovedmessage.h \
$$PWD/cmbunregistertranslationunitsforeditormessage.h \ $$PWD/documentsclosedmessage.h \
$$PWD/codecompletionchunk.h \ $$PWD/codecompletionchunk.h \
$$PWD/codecompletion.h \ $$PWD/codecompletion.h \
$$PWD/connectionclient.h \ $$PWD/connectionclient.h \
$$PWD/connectionserver.h \ $$PWD/connectionserver.h \
$$PWD/diagnosticcontainer.h \ $$PWD/diagnosticcontainer.h \
$$PWD/documentannotationschangedmessage.h \ $$PWD/annotationsmessage.h \
$$PWD/dynamicastmatcherdiagnosticcontainer.h \ $$PWD/dynamicastmatcherdiagnosticcontainer.h \
$$PWD/dynamicastmatcherdiagnosticcontextcontainer.h \ $$PWD/dynamicastmatcherdiagnosticcontextcontainer.h \
$$PWD/dynamicastmatcherdiagnosticmessagecontainer.h \ $$PWD/dynamicastmatcherdiagnosticmessagecontainer.h \
@@ -149,9 +149,9 @@ HEADERS += \
$$PWD/refactoringserverinterface.h \ $$PWD/refactoringserverinterface.h \
$$PWD/refactoringserverproxy.h \ $$PWD/refactoringserverproxy.h \
$$PWD/referencesmessage.h \ $$PWD/referencesmessage.h \
$$PWD/registerunsavedfilesforeditormessage.h \ $$PWD/unsavedfilesupdatedmessage.h \
$$PWD/removeprojectpartsmessage.h \ $$PWD/removeprojectpartsmessage.h \
$$PWD/requestdocumentannotations.h \ $$PWD/requestannotationsmessage.h \
$$PWD/requestfollowsymbolmessage.h \ $$PWD/requestfollowsymbolmessage.h \
$$PWD/requestreferencesmessage.h \ $$PWD/requestreferencesmessage.h \
$$PWD/requestsourcelocationforrenamingmessage.h \ $$PWD/requestsourcelocationforrenamingmessage.h \
@@ -177,10 +177,10 @@ HEADERS += \
$$PWD/tokeninfocontainer.h \ $$PWD/tokeninfocontainer.h \
$$PWD/tooltipmessage.h \ $$PWD/tooltipmessage.h \
$$PWD/tooltipinfo.h \ $$PWD/tooltipinfo.h \
$$PWD/unregisterunsavedfilesforeditormessage.h \ $$PWD/unsavedfilesremovedmessage.h \
$$PWD/updateprojectpartsmessage.h \ $$PWD/updateprojectpartsmessage.h \
$$PWD/updatetranslationunitsforeditormessage.h \ $$PWD/documentschangedmessage.h \
$$PWD/updatevisibletranslationunitsmessage.h \ $$PWD/documentvisibilitychangedmessage.h \
$$PWD/writemessageblock.h \ $$PWD/writemessageblock.h \
$$PWD/ipcclientprovider.h \ $$PWD/ipcclientprovider.h \
$$PWD/requestsourcerangesforquerymessage.h \ $$PWD/requestsourcerangesforquerymessage.h \

View File

@@ -138,18 +138,19 @@ enum class MessageType : quint8 {
EchoMessage, EchoMessage,
EndMessage, EndMessage,
RegisterTranslationUnitForEditorMessage, DocumentsOpenedMessage,
UpdateTranslationUnitsForEditorMessage, DocumentsChangedMessage,
UnregisterTranslationUnitsForEditorMessage, DocumentsClosedMessage,
DocumentVisibilityChangedMessage,
RegisterUnsavedFilesForEditorMessage, UnsavedFilesUpdatedMessage,
UnregisterUnsavedFilesForEditorMessage, UnsavedFilesRemovedMessage,
RegisterProjectPartsForEditorMessage, ProjectPartsUpdatedMessage,
UnregisterProjectPartsForEditorMessage, ProjectPartsRemovedMessage,
RequestDocumentAnnotationsMessage, RequestAnnotationsMessage,
DocumentAnnotationsChangedMessage, AnnotationsMessage,
RequestReferencesMessage, RequestReferencesMessage,
ReferencesMessage, ReferencesMessage,
@@ -160,10 +161,8 @@ enum class MessageType : quint8 {
RequestToolTipMessage, RequestToolTipMessage,
ToolTipMessage, ToolTipMessage,
UpdateVisibleTranslationUnitsMessage, RequestCompletionsMessage,
CompletionsMessage,
CompleteCodeMessage,
CodeCompletedMessage,
SourceLocationsForRenamingMessage, SourceLocationsForRenamingMessage,
RequestSourceLocationsForRenamingMessage, RequestSourceLocationsForRenamingMessage,

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbcodecompletedmessage.h" #include "completionsmessage.h"
#include <QDebug> #include <QDebug>
@@ -40,9 +40,9 @@ static const char *completionCorrectionToText(CompletionCorrection correction)
} }
#undef RETURN_TEXT_FOR_CASE #undef RETURN_TEXT_FOR_CASE
QDebug operator<<(QDebug debug, const CodeCompletedMessage &message) QDebug operator<<(QDebug debug, const CompletionsMessage &message)
{ {
debug.nospace() << "CodeCompletedMessage("; debug.nospace() << "CompletionsMessage(";
debug.nospace() << message.codeCompletions << ", " debug.nospace() << message.codeCompletions << ", "
<< completionCorrectionToText(message.neededCorrection) << ", " << completionCorrectionToText(message.neededCorrection) << ", "

View File

@@ -33,20 +33,20 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class CodeCompletedMessage class CompletionsMessage
{ {
public: public:
CodeCompletedMessage() = default; CompletionsMessage() = default;
CodeCompletedMessage(const CodeCompletions &codeCompletions, CompletionsMessage(const CodeCompletions &codeCompletions,
CompletionCorrection neededCorrection, CompletionCorrection neededCorrection,
quint64 ticketNumber) quint64 ticketNumber)
: codeCompletions(codeCompletions), : codeCompletions(codeCompletions)
ticketNumber(ticketNumber), , ticketNumber(ticketNumber)
neededCorrection(neededCorrection) , neededCorrection(neededCorrection)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message) friend QDataStream &operator<<(QDataStream &out, const CompletionsMessage &message)
{ {
out << message.codeCompletions; out << message.codeCompletions;
out << static_cast<quint32>(message.neededCorrection); out << static_cast<quint32>(message.neededCorrection);
@@ -55,7 +55,7 @@ public:
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message) friend QDataStream &operator>>(QDataStream &in, CompletionsMessage &message)
{ {
quint32 neededCorrection; quint32 neededCorrection;
@@ -68,7 +68,7 @@ public:
return in; return in;
} }
friend bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second) friend bool operator==(const CompletionsMessage &first, const CompletionsMessage &second)
{ {
return first.ticketNumber == second.ticketNumber return first.ticketNumber == second.ticketNumber
&& first.neededCorrection == second.neededCorrection && first.neededCorrection == second.neededCorrection
@@ -81,7 +81,7 @@ public:
CompletionCorrection neededCorrection = CompletionCorrection::NoCorrection; CompletionCorrection neededCorrection = CompletionCorrection::NoCorrection;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CompletionsMessage &message);
DECLARE_MESSAGE(CodeCompletedMessage) DECLARE_MESSAGE(CompletionsMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "registerunsavedfilesforeditormessage.h" #include "documentschangedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message) QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message)
{ {
debug.nospace() << "RegisterUnsavedFilesForEditorMessage("; debug.nospace() << "DocumentsChangedMessage(";
for (const FileContainer &fileContainer : message.fileContainers) for (const FileContainer &fileContainer : message.fileContainers)
debug.nospace() << fileContainer<< ", "; debug.nospace() << fileContainer<< ", ";

View File

@@ -31,30 +31,31 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class RegisterUnsavedFilesForEditorMessage class DocumentsChangedMessage
{ {
public: public:
RegisterUnsavedFilesForEditorMessage() = default; DocumentsChangedMessage() = default;
RegisterUnsavedFilesForEditorMessage(const QVector<FileContainer> &fileContainers) DocumentsChangedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers) : fileContainers(fileContainers)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const DocumentsChangedMessage &message)
{ {
out << message.fileContainers; out << message.fileContainers;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, DocumentsChangedMessage &message)
{ {
in >> message.fileContainers; in >> message.fileContainers;
return in; return in;
} }
friend bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second) friend bool operator==(const DocumentsChangedMessage &first,
const DocumentsChangedMessage &second)
{ {
return first.fileContainers == second.fileContainers; return first.fileContainers == second.fileContainers;
} }
@@ -63,7 +64,7 @@ public:
QVector<FileContainer> fileContainers; QVector<FileContainer> fileContainers;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message);
DECLARE_MESSAGE(RegisterUnsavedFilesForEditorMessage); DECLARE_MESSAGE(DocumentsChangedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbunregistertranslationunitsforeditormessage.h" #include "documentsclosedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message) QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message)
{ {
debug.nospace() << "UnregisterTranslationUnitsForEditorMessage("; debug.nospace() << "DocumentsClosedMessage(";
for (const FileContainer &fileContainer : message.fileContainers) for (const FileContainer &fileContainer : message.fileContainers)
debug.nospace() << fileContainer << ", "; debug.nospace() << fileContainer << ", ";

View File

@@ -25,36 +25,38 @@
#pragma once #pragma once
#include "clangsupport_global.h"
#include "filecontainer.h" #include "filecontainer.h"
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
class UpdateTranslationUnitsForEditorMessage class DocumentsClosedMessage
{ {
public: public:
UpdateTranslationUnitsForEditorMessage() = default; DocumentsClosedMessage() = default;
UpdateTranslationUnitsForEditorMessage(const QVector<FileContainer> &fileContainers) DocumentsClosedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers) : fileContainers(fileContainers)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const DocumentsClosedMessage &message)
{ {
out << message.fileContainers; out << message.fileContainers;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, DocumentsClosedMessage &message)
{ {
in >> message.fileContainers; in >> message.fileContainers;
return in; return in;
} }
friend bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second) friend bool operator==(const DocumentsClosedMessage &first, const DocumentsClosedMessage &second)
{ {
return first.fileContainers == second.fileContainers; return first.fileContainers == second.fileContainers;
} }
@@ -63,7 +65,7 @@ public:
QVector<FileContainer> fileContainers; QVector<FileContainer> fileContainers;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message);
DECLARE_MESSAGE(UpdateTranslationUnitsForEditorMessage) DECLARE_MESSAGE(DocumentsClosedMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbregistertranslationunitsforeditormessage.h" #include "documentsopenedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message) QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message)
{ {
debug.nospace() << "RegisterTranslationUnitForEditorMessage("; debug.nospace() << "DocumentsOpenedMessage(";
for (const FileContainer &fileContainer : message.fileContainers) for (const FileContainer &fileContainer : message.fileContainers)
debug.nospace() << fileContainer<< ", "; debug.nospace() << fileContainer<< ", ";

View File

@@ -32,20 +32,20 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class RegisterTranslationUnitForEditorMessage class DocumentsOpenedMessage
{ {
public: public:
RegisterTranslationUnitForEditorMessage() = default; DocumentsOpenedMessage() = default;
RegisterTranslationUnitForEditorMessage(const QVector<FileContainer> &fileContainers, DocumentsOpenedMessage(const QVector<FileContainer> &fileContainers,
const Utf8String &currentEditorFilePath, const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorFilePaths) const Utf8StringVector &visibleEditorFilePaths)
: fileContainers(fileContainers), : fileContainers(fileContainers)
currentEditorFilePath(currentEditorFilePath), , currentEditorFilePath(currentEditorFilePath)
visibleEditorFilePaths(visibleEditorFilePaths) , visibleEditorFilePaths(visibleEditorFilePaths)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const DocumentsOpenedMessage &message)
{ {
out << message.fileContainers; out << message.fileContainers;
out << message.currentEditorFilePath; out << message.currentEditorFilePath;
@@ -53,7 +53,7 @@ public:
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, DocumentsOpenedMessage &message)
{ {
in >> message.fileContainers; in >> message.fileContainers;
in >> message.currentEditorFilePath; in >> message.currentEditorFilePath;
@@ -62,7 +62,7 @@ public:
return in; return in;
} }
friend bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second) friend bool operator==(const DocumentsOpenedMessage &first, const DocumentsOpenedMessage &second)
{ {
return first.fileContainers == second.fileContainers return first.fileContainers == second.fileContainers
&& first.currentEditorFilePath == second.currentEditorFilePath && first.currentEditorFilePath == second.currentEditorFilePath
@@ -75,7 +75,7 @@ public:
Utf8StringVector visibleEditorFilePaths; Utf8StringVector visibleEditorFilePaths;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message);
DECLARE_MESSAGE(RegisterTranslationUnitForEditorMessage); DECLARE_MESSAGE(DocumentsOpenedMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "updatevisibletranslationunitsmessage.h" #include "documentvisibilitychangedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message) QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message)
{ {
debug.nospace() << "UpdateVisibleTranslationUnitsMessage("; debug.nospace() << "DocumentVisibilityChangedMessage(";
debug.nospace() << message.currentEditorFilePath << ", "; debug.nospace() << message.currentEditorFilePath << ", ";

View File

@@ -33,18 +33,18 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class UpdateVisibleTranslationUnitsMessage class DocumentVisibilityChangedMessage
{ {
public: public:
UpdateVisibleTranslationUnitsMessage() = default; DocumentVisibilityChangedMessage() = default;
UpdateVisibleTranslationUnitsMessage(const Utf8String &currentEditorFilePath, DocumentVisibilityChangedMessage(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorFilePaths) const Utf8StringVector &visibleEditorFilePaths)
: currentEditorFilePath(currentEditorFilePath), : currentEditorFilePath(currentEditorFilePath)
visibleEditorFilePaths(visibleEditorFilePaths) , visibleEditorFilePaths(visibleEditorFilePaths)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const UpdateVisibleTranslationUnitsMessage &message) friend QDataStream &operator<<(QDataStream &out, const DocumentVisibilityChangedMessage &message)
{ {
out << message.currentEditorFilePath; out << message.currentEditorFilePath;
out << message.visibleEditorFilePaths; out << message.visibleEditorFilePaths;
@@ -52,7 +52,7 @@ public:
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, UpdateVisibleTranslationUnitsMessage &message) friend QDataStream &operator>>(QDataStream &in, DocumentVisibilityChangedMessage &message)
{ {
in >> message.currentEditorFilePath; in >> message.currentEditorFilePath;
in >> message.visibleEditorFilePaths; in >> message.visibleEditorFilePaths;
@@ -60,7 +60,8 @@ public:
return in; return in;
} }
friend bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second) friend bool operator==(const DocumentVisibilityChangedMessage &first,
const DocumentVisibilityChangedMessage &second)
{ {
return first.currentEditorFilePath == second.currentEditorFilePath return first.currentEditorFilePath == second.currentEditorFilePath
&& first.visibleEditorFilePaths == second.visibleEditorFilePaths; && first.visibleEditorFilePaths == second.visibleEditorFilePaths;
@@ -71,7 +72,7 @@ public:
Utf8StringVector visibleEditorFilePaths; Utf8StringVector visibleEditorFilePaths;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message);
DECLARE_MESSAGE(UpdateVisibleTranslationUnitsMessage) DECLARE_MESSAGE(DocumentVisibilityChangedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbechomessage.h" #include "echomessage.h"
#include <QDebug> #include <QDebug>

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbendmessage.h" #include "endmessage.h"
#include <QDebug> #include <QDebug>
@@ -34,4 +34,4 @@ QDebug operator<<(QDebug debug, const EndMessage &/*message*/)
return debug.nospace() << "EndMessage()"; return debug.nospace() << "EndMessage()";
} }
} } // namespace ClangBackEnd

View File

@@ -29,12 +29,23 @@
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const FollowSymbolResult &result)
{
debug.nospace() << "FollowSymbolResult("
<< result.range
<< ", " << result.isPureDeclarationForUsage;
debug.nospace() << ")";
return debug;
}
QDebug operator<<(QDebug debug, const FollowSymbolMessage &message) QDebug operator<<(QDebug debug, const FollowSymbolMessage &message)
{ {
debug.nospace() << "FollowSymbolMessage(" debug.nospace() << "FollowSymbolMessage("
<< message.fileContainer << message.fileContainer
<< ", " << message.ticketNumber << ", " << message.ticketNumber
<< ", " << message.sourceRange; << ", " << message.result;
debug.nospace() << ")"; debug.nospace() << ")";

View File

@@ -33,15 +33,53 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class FollowSymbolResult
{
public:
FollowSymbolResult() = default;
FollowSymbolResult(SourceRangeContainer range)
: range(std::move(range))
{}
FollowSymbolResult(SourceRangeContainer range, bool isPureDeclarationForUsage)
: range(std::move(range))
, isPureDeclarationForUsage(isPureDeclarationForUsage)
{}
friend QDataStream &operator<<(QDataStream &out, const FollowSymbolResult &container)
{
out << container.range;
out << container.isPureDeclarationForUsage;
return out;
}
friend QDataStream &operator>>(QDataStream &in, FollowSymbolResult &container)
{
in >> container.range;
in >> container.isPureDeclarationForUsage;
return in;
}
friend bool operator==(const FollowSymbolResult &first, const FollowSymbolResult &second)
{
return first.range == second.range
&& first.isPureDeclarationForUsage == second.isPureDeclarationForUsage;
}
SourceRangeContainer range;
bool isPureDeclarationForUsage = false;
};
class FollowSymbolMessage class FollowSymbolMessage
{ {
public: public:
FollowSymbolMessage() = default; FollowSymbolMessage() = default;
FollowSymbolMessage(const FileContainer &fileContainer, FollowSymbolMessage(const FileContainer &fileContainer,
const SourceRangeContainer &range, const FollowSymbolResult &result,
quint64 ticketNumber) quint64 ticketNumber)
: fileContainer(fileContainer) : fileContainer(fileContainer)
, sourceRange(range) , result(result)
, ticketNumber(ticketNumber) , ticketNumber(ticketNumber)
{ {
} }
@@ -49,7 +87,7 @@ public:
friend QDataStream &operator<<(QDataStream &out, const FollowSymbolMessage &message) friend QDataStream &operator<<(QDataStream &out, const FollowSymbolMessage &message)
{ {
out << message.fileContainer; out << message.fileContainer;
out << message.sourceRange; out << message.result;
out << message.ticketNumber; out << message.ticketNumber;
return out; return out;
} }
@@ -57,7 +95,7 @@ public:
friend QDataStream &operator>>(QDataStream &in, FollowSymbolMessage &message) friend QDataStream &operator>>(QDataStream &in, FollowSymbolMessage &message)
{ {
in >> message.fileContainer; in >> message.fileContainer;
in >> message.sourceRange; in >> message.result;
in >> message.ticketNumber; in >> message.ticketNumber;
return in; return in;
} }
@@ -66,15 +104,16 @@ public:
{ {
return first.ticketNumber == second.ticketNumber return first.ticketNumber == second.ticketNumber
&& first.fileContainer == second.fileContainer && first.fileContainer == second.fileContainer
&& first.sourceRange == second.sourceRange; && first.result == second.result;
} }
public: public:
FileContainer fileContainer; FileContainer fileContainer;
SourceRangeContainer sourceRange; FollowSymbolResult result;
quint64 ticketNumber = 0; quint64 ticketNumber = 0;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolResult &result);
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolMessage &message);
DECLARE_MESSAGE(FollowSymbolMessage); DECLARE_MESSAGE(FollowSymbolMessage);

View File

@@ -38,32 +38,35 @@ QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop)
case MessageType::EndMessage: case MessageType::EndMessage:
qDebug() << "EndMessage()"; qDebug() << "EndMessage()";
break; break;
case MessageType::RegisterTranslationUnitForEditorMessage: case MessageType::DocumentsOpenedMessage:
qDebug() << messageEnvelop.message<RegisterTranslationUnitForEditorMessage>(); qDebug() << messageEnvelop.message<DocumentsOpenedMessage>();
break; break;
case MessageType::UpdateTranslationUnitsForEditorMessage: case MessageType::DocumentsChangedMessage:
qDebug() << messageEnvelop.message<UpdateTranslationUnitsForEditorMessage>(); qDebug() << messageEnvelop.message<DocumentsChangedMessage>();
break; break;
case MessageType::UnregisterTranslationUnitsForEditorMessage: case MessageType::DocumentsClosedMessage:
qDebug() << messageEnvelop.message<UnregisterTranslationUnitsForEditorMessage>(); qDebug() << messageEnvelop.message<DocumentsClosedMessage>();
break; break;
case MessageType::RegisterProjectPartsForEditorMessage: case MessageType::DocumentVisibilityChangedMessage:
qDebug() << messageEnvelop.message<RegisterProjectPartsForEditorMessage>(); qDebug() << messageEnvelop.message<DocumentVisibilityChangedMessage>();
break; break;
case MessageType::UnregisterProjectPartsForEditorMessage: case MessageType::ProjectPartsUpdatedMessage:
qDebug() << messageEnvelop.message<UnregisterProjectPartsForEditorMessage>(); qDebug() << messageEnvelop.message<ProjectPartsUpdatedMessage>();
break; break;
case MessageType::RegisterUnsavedFilesForEditorMessage: case MessageType::ProjectPartsRemovedMessage:
qDebug() << messageEnvelop.message<RegisterUnsavedFilesForEditorMessage>(); qDebug() << messageEnvelop.message<ProjectPartsRemovedMessage>();
break; break;
case MessageType::UnregisterUnsavedFilesForEditorMessage: case MessageType::UnsavedFilesUpdatedMessage:
qDebug() << messageEnvelop.message<UnregisterUnsavedFilesForEditorMessage>(); qDebug() << messageEnvelop.message<UnsavedFilesUpdatedMessage>();
break; break;
case MessageType::CompleteCodeMessage: case MessageType::UnsavedFilesRemovedMessage:
qDebug() << messageEnvelop.message<CompleteCodeMessage>(); qDebug() << messageEnvelop.message<UnsavedFilesRemovedMessage>();
break; break;
case MessageType::RequestDocumentAnnotationsMessage: case MessageType::RequestCompletionsMessage:
qDebug() << messageEnvelop.message<RequestDocumentAnnotationsMessage>(); qDebug() << messageEnvelop.message<RequestCompletionsMessage>();
break;
case MessageType::RequestAnnotationsMessage:
qDebug() << messageEnvelop.message<RequestAnnotationsMessage>();
break; break;
case MessageType::RequestReferencesMessage: case MessageType::RequestReferencesMessage:
qDebug() << messageEnvelop.message<RequestReferencesMessage>(); qDebug() << messageEnvelop.message<RequestReferencesMessage>();
@@ -71,17 +74,14 @@ QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop)
case MessageType::RequestToolTipMessage: case MessageType::RequestToolTipMessage:
qDebug() << messageEnvelop.message<RequestToolTipMessage>(); qDebug() << messageEnvelop.message<RequestToolTipMessage>();
break; break;
case MessageType::UpdateVisibleTranslationUnitsMessage:
qDebug() << messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>();
break;
case MessageType::AliveMessage: case MessageType::AliveMessage:
qDebug() << "AliveMessage()"; qDebug() << "AliveMessage()";
break; break;
case MessageType::EchoMessage: case MessageType::EchoMessage:
qDebug() << messageEnvelop.message<EchoMessage>(); qDebug() << messageEnvelop.message<EchoMessage>();
break; break;
case MessageType::CodeCompletedMessage: case MessageType::CompletionsMessage:
qDebug() << messageEnvelop.message<CodeCompletedMessage>(); qDebug() << messageEnvelop.message<CompletionsMessage>();
break; break;
case MessageType::ReferencesMessage: case MessageType::ReferencesMessage:
qDebug() << messageEnvelop.message<ReferencesMessage>(); qDebug() << messageEnvelop.message<ReferencesMessage>();
@@ -89,8 +89,8 @@ QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop)
case MessageType::ToolTipMessage: case MessageType::ToolTipMessage:
qDebug() << messageEnvelop.message<ToolTipMessage>(); qDebug() << messageEnvelop.message<ToolTipMessage>();
break; break;
case MessageType::DocumentAnnotationsChangedMessage: case MessageType::AnnotationsMessage:
qDebug() << messageEnvelop.message<DocumentAnnotationsChangedMessage>(); qDebug() << messageEnvelop.message<AnnotationsMessage>();
break; break;
default: default:
qWarning() << "Unknown Message"; qWarning() << "Unknown Message";

View File

@@ -25,7 +25,7 @@
#include "pchmanagerclientproxy.h" #include "pchmanagerclientproxy.h"
#include "cmbalivemessage.h" #include "alivemessage.h"
#include "messageenvelop.h" #include "messageenvelop.h"
#include "pchmanagerserverinterface.h" #include "pchmanagerserverinterface.h"
#include "precompiledheadersupdatedmessage.h" #include "precompiledheadersupdatedmessage.h"

View File

@@ -25,7 +25,7 @@
#include "pchmanagerserverproxy.h" #include "pchmanagerserverproxy.h"
#include "cmbendmessage.h" #include "endmessage.h"
#include "messageenvelop.h" #include "messageenvelop.h"
#include "pchmanagerclientinterface.h" #include "pchmanagerclientinterface.h"
#include "removeprojectpartsmessage.h" #include "removeprojectpartsmessage.h"

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbunregisterprojectsforeditormessage.h" #include "projectpartsremovedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message) QDebug operator<<(QDebug debug, const ProjectPartsRemovedMessage &message)
{ {
debug.nospace() << "UnregisterProjectPartsForEditorMessage("; debug.nospace() << "ProjectPartsRemovedMessage(";
for (const Utf8String &fileNames_ : message.projectPartIds) for (const Utf8String &fileNames_ : message.projectPartIds)
debug.nospace() << fileNames_ << ", "; debug.nospace() << fileNames_ << ", ";

View File

@@ -33,30 +33,31 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT UnregisterProjectPartsForEditorMessage class CLANGSUPPORT_EXPORT ProjectPartsRemovedMessage
{ {
public: public:
UnregisterProjectPartsForEditorMessage() = default; ProjectPartsRemovedMessage() = default;
UnregisterProjectPartsForEditorMessage(const Utf8StringVector &projectPartIds) ProjectPartsRemovedMessage(const Utf8StringVector &projectPartIds)
: projectPartIds(projectPartIds) : projectPartIds(projectPartIds)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const ProjectPartsRemovedMessage &message)
{ {
out << message.projectPartIds; out << message.projectPartIds;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, ProjectPartsRemovedMessage &message)
{ {
in >> message.projectPartIds; in >> message.projectPartIds;
return in; return in;
} }
friend bool operator==(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second) friend bool operator==(const ProjectPartsRemovedMessage &first,
const ProjectPartsRemovedMessage &second)
{ {
return first.projectPartIds == second.projectPartIds; return first.projectPartIds == second.projectPartIds;
} }
@@ -65,7 +66,7 @@ public:
Utf8StringVector projectPartIds; Utf8StringVector projectPartIds;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsRemovedMessage &message);
DECLARE_MESSAGE(UnregisterProjectPartsForEditorMessage); DECLARE_MESSAGE(ProjectPartsRemovedMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbregisterprojectsforeditormessage.h" #include "projectpartsupdatedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message) QDebug operator<<(QDebug debug, const ProjectPartsUpdatedMessage &message)
{ {
debug.nospace() << "RegisterProjectPartsForEditorMessage("; debug.nospace() << "ProjectPartsUpdatedMessage(";
for (const ProjectPartContainer &projectContainer : message.projectContainers) for (const ProjectPartContainer &projectContainer : message.projectContainers)
debug.nospace() << projectContainer<< ", "; debug.nospace() << projectContainer<< ", ";

View File

@@ -32,30 +32,31 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class RegisterProjectPartsForEditorMessage class ProjectPartsUpdatedMessage
{ {
public: public:
RegisterProjectPartsForEditorMessage() = default; ProjectPartsUpdatedMessage() = default;
RegisterProjectPartsForEditorMessage(const QVector<ProjectPartContainer> &projectContainers) ProjectPartsUpdatedMessage(const QVector<ProjectPartContainer> &projectContainers)
: projectContainers(projectContainers) : projectContainers(projectContainers)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const ProjectPartsUpdatedMessage &message)
{ {
out << message.projectContainers; out << message.projectContainers;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, ProjectPartsUpdatedMessage &message)
{ {
in >> message.projectContainers; in >> message.projectContainers;
return in; return in;
} }
friend bool operator==(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second) friend bool operator==(const ProjectPartsUpdatedMessage &first,
const ProjectPartsUpdatedMessage &second)
{ {
return first.projectContainers == second.projectContainers; return first.projectContainers == second.projectContainers;
} }
@@ -64,7 +65,7 @@ public:
QVector<ProjectPartContainer> projectContainers; QVector<ProjectPartContainer> projectContainers;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsUpdatedMessage &message);
DECLARE_MESSAGE(RegisterProjectPartsForEditorMessage); DECLARE_MESSAGE(ProjectPartsUpdatedMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -25,7 +25,7 @@
#include "refactoringclientproxy.h" #include "refactoringclientproxy.h"
#include "cmbalivemessage.h" #include "alivemessage.h"
#include "messageenvelop.h" #include "messageenvelop.h"
#include "refactoringserverinterface.h" #include "refactoringserverinterface.h"
#include "clangrefactoringclientmessages.h" #include "clangrefactoringclientmessages.h"

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "requestdocumentannotations.h" #include "requestannotationsmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const RequestDocumentAnnotationsMessage &message) QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message)
{ {
debug.nospace() << "RequestDocumentAnnotationsMessage(" debug.nospace() << "RequestAnnotationsMessage("
<< message.fileContainer << message.fileContainer
<< ")"; << ")";

View File

@@ -29,30 +29,31 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class RequestDocumentAnnotationsMessage class RequestAnnotationsMessage
{ {
public: public:
RequestDocumentAnnotationsMessage() = default; RequestAnnotationsMessage() = default;
RequestDocumentAnnotationsMessage(const FileContainer &fileContainer) RequestAnnotationsMessage(const FileContainer &fileContainer)
: fileContainer(fileContainer) : fileContainer(fileContainer)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const RequestDocumentAnnotationsMessage &message) friend QDataStream &operator<<(QDataStream &out, const RequestAnnotationsMessage &message)
{ {
out << message.fileContainer; out << message.fileContainer;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, RequestDocumentAnnotationsMessage &message) friend QDataStream &operator>>(QDataStream &in, RequestAnnotationsMessage &message)
{ {
in >> message.fileContainer; in >> message.fileContainer;
return in; return in;
} }
friend bool operator==(const RequestDocumentAnnotationsMessage &first, const RequestDocumentAnnotationsMessage &second) friend bool operator==(const RequestAnnotationsMessage &first,
const RequestAnnotationsMessage &second)
{ {
return first.fileContainer == second.fileContainer; return first.fileContainer == second.fileContainer;
} }
@@ -61,7 +62,7 @@ public:
FileContainer fileContainer; FileContainer fileContainer;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestDocumentAnnotationsMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message);
DECLARE_MESSAGE(RequestDocumentAnnotationsMessage); DECLARE_MESSAGE(RequestAnnotationsMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,17 +23,17 @@
** **
****************************************************************************/ ****************************************************************************/
#include "cmbcompletecodemessage.h" #include "requestcompletionsmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
quint64 CompleteCodeMessage::ticketCounter = 0; quint64 RequestCompletionsMessage::ticketCounter = 0;
QDebug operator<<(QDebug debug, const CompleteCodeMessage &message) QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message)
{ {
debug.nospace() << "CompleteCodeMessage("; debug.nospace() << "RequestCompletionsMessage(";
debug.nospace() << message.filePath << ", "; debug.nospace() << message.filePath << ", ";
debug.nospace() << message.line << ", "; debug.nospace() << message.line << ", ";

View File

@@ -33,27 +33,27 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class CompleteCodeMessage class RequestCompletionsMessage
{ {
public: public:
CompleteCodeMessage() = default; RequestCompletionsMessage() = default;
CompleteCodeMessage(const Utf8String &filePath, RequestCompletionsMessage(const Utf8String &filePath,
quint32 line, quint32 line,
quint32 column, quint32 column,
const Utf8String &projectPartId, const Utf8String &projectPartId,
qint32 funcNameStartLine = -1, qint32 funcNameStartLine = -1,
qint32 funcNameStartColumn = -1) qint32 funcNameStartColumn = -1)
: filePath(filePath), : filePath(filePath)
projectPartId(projectPartId), , projectPartId(projectPartId)
ticketNumber(++ticketCounter), , ticketNumber(++ticketCounter)
line(line), , line(line)
column(column), , column(column)
funcNameStartLine(funcNameStartLine), , funcNameStartLine(funcNameStartLine)
funcNameStartColumn(funcNameStartColumn) , funcNameStartColumn(funcNameStartColumn)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message) friend QDataStream &operator<<(QDataStream &out, const RequestCompletionsMessage &message)
{ {
out << message.filePath; out << message.filePath;
out << message.projectPartId; out << message.projectPartId;
@@ -66,7 +66,7 @@ public:
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, CompleteCodeMessage &message) friend QDataStream &operator>>(QDataStream &in, RequestCompletionsMessage &message)
{ {
in >> message.filePath; in >> message.filePath;
in >> message.projectPartId; in >> message.projectPartId;
@@ -79,7 +79,8 @@ public:
return in; return in;
} }
friend bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second) friend bool operator==(const RequestCompletionsMessage &first,
const RequestCompletionsMessage &second)
{ {
return first.ticketNumber == second.ticketNumber return first.ticketNumber == second.ticketNumber
&& first.filePath == second.filePath && first.filePath == second.filePath
@@ -101,7 +102,7 @@ public:
qint32 funcNameStartColumn = -1; qint32 funcNameStartColumn = -1;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message);
DECLARE_MESSAGE(CompleteCodeMessage); DECLARE_MESSAGE(RequestCompletionsMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "updatetranslationunitsforeditormessage.h" #include "unsavedfilesremovedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message) QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message)
{ {
debug.nospace() << "UpdateTranslationUnitsForEditorMessage("; debug.nospace() << "UnsavedFilesRemovedMessage(";
for (const FileContainer &fileContainer : message.fileContainers) for (const FileContainer &fileContainer : message.fileContainers)
debug.nospace() << fileContainer<< ", "; debug.nospace() << fileContainer<< ", ";

View File

@@ -31,30 +31,31 @@
namespace ClangBackEnd { namespace ClangBackEnd {
class UnregisterUnsavedFilesForEditorMessage class UnsavedFilesRemovedMessage
{ {
public: public:
UnregisterUnsavedFilesForEditorMessage() = default; UnsavedFilesRemovedMessage() = default;
UnregisterUnsavedFilesForEditorMessage(const QVector<FileContainer> &fileContainers) UnsavedFilesRemovedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers) : fileContainers(fileContainers)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesRemovedMessage &message)
{ {
out << message.fileContainers; out << message.fileContainers;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, UnsavedFilesRemovedMessage &message)
{ {
in >> message.fileContainers; in >> message.fileContainers;
return in; return in;
} }
friend bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second) friend bool operator==(const UnsavedFilesRemovedMessage &first,
const UnsavedFilesRemovedMessage &second)
{ {
return first.fileContainers == second.fileContainers; return first.fileContainers == second.fileContainers;
} }
@@ -63,7 +64,7 @@ public:
QVector<FileContainer> fileContainers; QVector<FileContainer> fileContainers;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message);
DECLARE_MESSAGE(UnregisterUnsavedFilesForEditorMessage) DECLARE_MESSAGE(UnsavedFilesRemovedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
** **
****************************************************************************/ ****************************************************************************/
#include "unregisterunsavedfilesforeditormessage.h" #include "unsavedfilesupdatedmessage.h"
#include <QDebug> #include <QDebug>
namespace ClangBackEnd { namespace ClangBackEnd {
QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message) QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message)
{ {
debug.nospace() << "UnregisterUnsavedFilesForEditorMessage("; debug.nospace() << "UnsavedFilesUpdatedMessage(";
for (const FileContainer &fileContainer : message.fileContainers) for (const FileContainer &fileContainer : message.fileContainers)
debug.nospace() << fileContainer<< ", "; debug.nospace() << fileContainer<< ", ";

View File

@@ -25,38 +25,37 @@
#pragma once #pragma once
#include "clangsupport_global.h"
#include "filecontainer.h" #include "filecontainer.h"
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
class UnregisterTranslationUnitsForEditorMessage class UnsavedFilesUpdatedMessage
{ {
public: public:
UnregisterTranslationUnitsForEditorMessage() = default; UnsavedFilesUpdatedMessage() = default;
UnregisterTranslationUnitsForEditorMessage(const QVector<FileContainer> &fileContainers) UnsavedFilesUpdatedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers) : fileContainers(fileContainers)
{ {
} }
friend QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message) friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesUpdatedMessage &message)
{ {
out << message.fileContainers; out << message.fileContainers;
return out; return out;
} }
friend QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message) friend QDataStream &operator>>(QDataStream &in, UnsavedFilesUpdatedMessage &message)
{ {
in >> message.fileContainers; in >> message.fileContainers;
return in; return in;
} }
friend bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second) friend bool operator==(const UnsavedFilesUpdatedMessage &first,
const UnsavedFilesUpdatedMessage &second)
{ {
return first.fileContainers == second.fileContainers; return first.fileContainers == second.fileContainers;
} }
@@ -65,7 +64,7 @@ public:
QVector<FileContainer> fileContainers; QVector<FileContainer> fileContainers;
}; };
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message); CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message);
DECLARE_MESSAGE(UnregisterTranslationUnitsForEditorMessage); DECLARE_MESSAGE(UnsavedFilesUpdatedMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -71,6 +71,11 @@ void QmlDebugConnectionManager::disconnectFromServer()
stopConnectionTimer(); stopConnectionTimer();
} }
bool QmlDebugConnectionManager::isConnecting() const
{
return m_connectionTimer.isActive();
}
static quint16 port16(const QUrl &url) static quint16 port16(const QUrl &url)
{ {
const int port32 = url.port(); const int port32 = url.port();

View File

@@ -44,6 +44,7 @@ public:
void connectToServer(const QUrl &server); void connectToServer(const QUrl &server);
void disconnectFromServer(); void disconnectFromServer();
bool isConnecting() const;
bool isConnected() const; bool isConnected() const;
void setRetryParams(int interval, int maxAttempts); void setRetryParams(int interval, int maxAttempts);

View File

@@ -30,6 +30,6 @@ TimelineText {
property int valueWidth: 170 property int valueWidth: 170
property int labelWidth: implicitWidth property int labelWidth: implicitWidth
font.bold: isLabel font.bold: isLabel
elide: Text.ElideRight elide: isLabel ? Text.ElideNone : Text.ElideRight
width: isLabel ? labelWidth : valueWidth width: isLabel ? labelWidth : valueWidth
} }

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.9
import TimelineTheme 1.0 import TimelineTheme 1.0
Item { Item {
@@ -153,7 +153,9 @@ Item {
spacing: innerMargin spacing: innerMargin
columns: 2 columns: 2
property int minimumWidth: {
property int minimumWidth: minimumInnerWidth
onPositioningComplete: {
// max(width of longest label * 2, minimumInnerWidth) // max(width of longest label * 2, minimumInnerWidth)
var result = minimumInnerWidth; var result = minimumInnerWidth;
for (var i = 0; i < children.length; ++i) { for (var i = 0; i < children.length; ++i) {
@@ -161,10 +163,10 @@ Item {
result = Math.max(children[i].implicitWidth * 2 + innerMargin, result); result = Math.max(children[i].implicitWidth * 2 + innerMargin, result);
} }
return result + 2 * outerMargin; minimumWidth = result + 2 * outerMargin;
} }
property int labelWidth: (minimumWidth - innerMargin) / 2 - outerMargin property int labelWidth: Math.ceil((minimumWidth - innerMargin) / 2) - outerMargin
property int valueWidth: dragHandle.x - labelWidth - innerMargin - outerMargin property int valueWidth: dragHandle.x - labelWidth - innerMargin - outerMargin
onMinimumWidthChanged: { onMinimumWidthChanged: {

View File

@@ -67,6 +67,11 @@ void TimelineTraceFile::fail(const QString &message)
m_future.cancel(); m_future.cancel();
} }
void TimelineTraceFile::finish()
{
m_future.reportFinished();
}
bool TimelineTraceFile::isCanceled() const bool TimelineTraceFile::isCanceled() const
{ {
return m_future.isCanceled(); return m_future.isCanceled();

View File

@@ -64,7 +64,9 @@ public:
virtual void save(QIODevice *device) = 0; virtual void save(QIODevice *device) = 0;
virtual void load(QIODevice *device) = 0; virtual void load(QIODevice *device) = 0;
void fail(const QString &message); void fail(const QString &message);
void finish();
void setTraceStart(qint64 traceStart) { m_traceStart = traceStart; } void setTraceStart(qint64 traceStart) { m_traceStart = traceStart; }
qint64 traceStart() const { return m_traceStart; } qint64 traceStart() const { return m_traceStart; }

View File

@@ -357,7 +357,6 @@ void TimelineTraceManager::clearEventStorage()
d->reset(); d->reset();
if (d->notesModel) if (d->notesModel)
d->notesModel->clear(); d->notesModel->clear();
setVisibleFeatures(0);
setRecordedFeatures(0); setRecordedFeatures(0);
d->eventStorage->clear(); d->eventStorage->clear();
} }
@@ -385,7 +384,6 @@ void TimelineTraceManager::restrictByFilter(TraceEventFilter filter)
d->notesModel->stash(); d->notesModel->stash();
d->reset(); d->reset();
setVisibleFeatures(0);
QFutureInterface<void> future; QFutureInterface<void> future;
replayEvents(filter(std::bind(&TimelineTraceManagerPrivate::dispatch, d, replayEvents(filter(std::bind(&TimelineTraceManagerPrivate::dispatch, d,

View File

@@ -51,6 +51,11 @@ public:
return first.isValid() && first.line == second.line && first.column == second.column; return first.isValid() && first.line == second.line && first.column == second.column;
} }
friend bool operator!=(LineColumn first, LineColumn second)
{
return !(first == second);
}
public: public:
int line = -1; int line = -1;
int column = -1; int column = -1;

View File

@@ -26,6 +26,7 @@
#pragma once #pragma once
#include "functiontraits.h" #include "functiontraits.h"
#include "optional.h"
#include "utils_global.h" #include "utils_global.h"
#include <QCoreApplication> #include <QCoreApplication>
@@ -57,6 +58,9 @@ struct hasCallOperator
}; };
namespace Utils { namespace Utils {
using StackSizeInBytes = Utils::optional<uint>;
namespace Internal { namespace Internal {
/* /*
@@ -388,6 +392,34 @@ private:
QRunnable *m_runnable; QRunnable *m_runnable;
}; };
template<typename Function,
typename... Args,
typename ResultType = typename Internal::resultType<Function>::type>
QFuture<ResultType> runAsync_internal(QThreadPool *pool,
StackSizeInBytes stackSize,
QThread::Priority priority,
Function &&function,
Args &&... args)
{
Q_ASSERT(!(pool && stackSize)); // stack size cannot be changed once a thread is started
auto job = new Internal::AsyncJob<ResultType,Function,Args...>
(std::forward<Function>(function), std::forward<Args>(args)...);
job->setThreadPriority(priority);
QFuture<ResultType> future = job->future();
if (pool) {
job->setThreadPool(pool);
pool->start(job);
} else {
auto thread = new Internal::RunnableThread(job);
if (stackSize)
thread->setStackSize(stackSize.value());
thread->moveToThread(qApp->thread()); // make sure thread gets deleteLater on main thread
QObject::connect(thread, &QThread::finished, thread, &QObject::deleteLater);
thread->start(priority);
}
return future;
}
} // Internal } // Internal
/*! /*!
@@ -418,20 +450,11 @@ template <typename Function, typename... Args,
QFuture<ResultType> QFuture<ResultType>
runAsync(QThreadPool *pool, QThread::Priority priority, Function &&function, Args&&... args) runAsync(QThreadPool *pool, QThread::Priority priority, Function &&function, Args&&... args)
{ {
auto job = new Internal::AsyncJob<ResultType,Function,Args...> return Internal::runAsync_internal(pool,
(std::forward<Function>(function), std::forward<Args>(args)...); StackSizeInBytes(),
job->setThreadPriority(priority); priority,
QFuture<ResultType> future = job->future(); std::forward<Function>(function),
if (pool) { std::forward<Args>(args)...);
job->setThreadPool(pool);
pool->start(job);
} else {
auto thread = new Internal::RunnableThread(job);
thread->moveToThread(qApp->thread()); // make sure thread gets deleteLater on main thread
QObject::connect(thread, &QThread::finished, thread, &QObject::deleteLater);
thread->start(priority);
}
return future;
} }
/*! /*!
@@ -448,6 +471,47 @@ runAsync(QThread::Priority priority, Function &&function, Args&&... args)
std::forward<Function>(function), std::forward<Args>(args)...); std::forward<Function>(function), std::forward<Args>(args)...);
} }
/*!
Runs \a function with \a args in a new thread with given thread \a stackSize and
thread priority QThread::InheritPriority .
\sa runAsync(QThreadPool*,QThread::Priority,Function&&,Args&&...)
\sa QThread::Priority
\sa QThread::setStackSize
*/
template<typename Function,
typename... Args,
typename ResultType = typename Internal::resultType<Function>::type>
QFuture<ResultType> runAsync(Utils::StackSizeInBytes stackSize, Function &&function, Args &&... args)
{
return Internal::runAsync_internal(static_cast<QThreadPool *>(nullptr),
stackSize,
QThread::InheritPriority,
std::forward<Function>(function),
std::forward<Args>(args)...);
}
/*!
Runs \a function with \a args in a new thread with given thread \a stackSize and
given thread \a priority.
\sa runAsync(QThreadPool*,QThread::Priority,Function&&,Args&&...)
\sa QThread::Priority
\sa QThread::setStackSize
*/
template<typename Function,
typename... Args,
typename ResultType = typename Internal::resultType<Function>::type>
QFuture<ResultType> runAsync(Utils::StackSizeInBytes stackSize,
QThread::Priority priority,
Function &&function,
Args &&... args)
{
return Internal::runAsync_internal(static_cast<QThreadPool *>(nullptr),
stackSize,
priority,
std::forward<Function>(function),
std::forward<Args>(args)...);
}
/*! /*!
Runs \a function with \a args in a new thread with thread priority QThread::InheritPriority. Runs \a function with \a args in a new thread with thread priority QThread::InheritPriority.
\sa runAsync(QThreadPool*,QThread::Priority,Function&&,Args&&...) \sa runAsync(QThreadPool*,QThread::Priority,Function&&,Args&&...)

View File

@@ -115,6 +115,7 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Core::Id id)
amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey"); amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey");
amStartArgsAspect->setLabelText(tr("Activity manager start options:")); amStartArgsAspect->setLabelText(tr("Activity manager start options:"));
amStartArgsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); amStartArgsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
amStartArgsAspect->setHistoryCompleter("Android.AmStartArgs.History");
addExtraAspect(amStartArgsAspect); addExtraAspect(amStartArgsAspect);
auto preStartShellCmdAspect = new BaseStringListAspect(this); auto preStartShellCmdAspect = new BaseStringListAspect(this);

View File

@@ -422,7 +422,7 @@ void AndroidRunnerWorker::asyncStartHelper()
runAdb(removeForward); runAdb(removeForward);
if (!runAdb({"forward", port, port})) { if (!runAdb({"forward", port, port})) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.") emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.")
.arg(m_lastRunAdbError)); .arg(m_lastRunAdbError) + "\n" + m_lastRunAdbRawOutput);
return; return;
} }
m_afterFinishAdbCommands.push_back(removeForward.join(' ')); m_afterFinishAdbCommands.push_back(removeForward.join(' '));

View File

@@ -193,15 +193,12 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
// not the best approach - but depending on the build system and whether the executables // not the best approach - but depending on the build system and whether the executables
// are going to get installed or not we have to soften the condition... // are going to get installed or not we have to soften the condition...
const QString currentExecutable = ensureExeEnding(runnable.executable); const QString currentExecutable = ensureExeEnding(runnable.executable);
const QString currentBST = runConfig->buildKey() + '|'; const QString currentBST = runConfig->buildKey();
qCDebug(LOG) << " CurrentExecutable" << currentExecutable; qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
qCDebug(LOG) << " BST of RunConfig" << currentBST; qCDebug(LOG) << " BST of RunConfig" << currentBST;
const bool isQbs = runConfig->id().toString().startsWith("Qbs.RunConfiguration:"); // BAD!
if ((localExecutable == currentExecutable) if ((localExecutable == currentExecutable)
|| (deployedExecutable == currentExecutable) || (deployedExecutable == currentExecutable)
|| (isQbs && Utils::anyOf(buildSystemTargets, [currentBST] (const QString &b) { || (buildSystemTargets.contains(currentBST))) {
return b.startsWith(currentBST);
}))) {
qCDebug(LOG) << " Using this RunConfig."; qCDebug(LOG) << " Using this RunConfig.";
m_origRunConfig = runConfig; m_origRunConfig = runConfig;
m_runnable = runnable; m_runnable = runnable;
@@ -240,7 +237,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
} }
if (m_displayName.isEmpty()) // happens e.g. when guessing the TestConfiguration or error if (m_displayName.isEmpty()) // happens e.g. when guessing the TestConfiguration or error
m_displayName = (*buildSystemTargets.begin()).split('|').first(); m_displayName = (*buildSystemTargets.begin());
} }
/** /**

View File

@@ -74,19 +74,23 @@ class DummyBackendSender : public ClangBackEnd::ClangCodeModelServerInterface
{ {
public: public:
void end() override {} void end() override {}
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &) override {}
void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &) override {} void documentsOpened(const DocumentsOpenedMessage &) override {}
void unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &) override {} void documentsChanged(const DocumentsChangedMessage &) override {}
void registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &) override {} void documentsClosed(const DocumentsClosedMessage &) override {}
void unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &) override {} void documentVisibilityChanged(const DocumentVisibilityChangedMessage &) override {}
void registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &) override {}
void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &) override {} void projectPartsUpdated(const ProjectPartsUpdatedMessage &) override {}
void completeCode(const CompleteCodeMessage &) override {} void projectPartsRemoved(const ProjectPartsRemovedMessage &) override {}
void requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &) override {}
void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &) override {}
void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &) override {}
void requestCompletions(const RequestCompletionsMessage &) override {}
void requestAnnotations(const RequestAnnotationsMessage &) override {}
void requestReferences(const RequestReferencesMessage &) override {} void requestReferences(const RequestReferencesMessage &) override {}
void requestFollowSymbol(const RequestFollowSymbolMessage &) override {} void requestFollowSymbol(const RequestFollowSymbolMessage &) override {}
void requestToolTip(const RequestToolTipMessage &) override {} void requestToolTip(const RequestToolTipMessage &) override {}
void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &) override {}
}; };
BackendCommunicator::BackendCommunicator() BackendCommunicator::BackendCommunicator()
@@ -161,12 +165,12 @@ static QVector<ProjectPartContainer> toProjectPartContainers(
return projectPartContainers; return projectPartContainers;
} }
void BackendCommunicator::registerFallbackProjectPart() void BackendCommunicator::projectPartsUpdatedForFallback()
{ {
const auto projectPart = CppTools::CppModelManager::instance()->fallbackProjectPart(); const auto projectPart = CppTools::CppModelManager::instance()->fallbackProjectPart();
const auto projectPartContainer = toProjectPartContainer(projectPart); const auto projectPartContainer = toProjectPartContainer(projectPart);
registerProjectPartsForEditor({projectPartContainer}); projectPartsUpdated({projectPartContainer});
} }
namespace { namespace {
@@ -232,36 +236,36 @@ Utf8StringVector visibleCppEditorDocumentsFilePaths()
} }
void BackendCommunicator::updateTranslationUnitVisiblity() void BackendCommunicator::documentVisibilityChanged()
{ {
updateTranslationUnitVisiblity(currentCppEditorDocumentFilePath(), visibleCppEditorDocumentsFilePaths()); documentVisibilityChanged(currentCppEditorDocumentFilePath(), visibleCppEditorDocumentsFilePaths());
} }
bool BackendCommunicator::isNotWaitingForCompletion() const bool BackendCommunicator::isNotWaitingForCompletion() const
{ {
return !m_receiver.isExpectingCodeCompletedMessage(); return !m_receiver.isExpectingCompletionsMessage();
} }
void BackendCommunicator::updateTranslationUnitVisiblity(const Utf8String &currentEditorFilePath, void BackendCommunicator::documentVisibilityChanged(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorsFilePaths) const Utf8StringVector &visibleEditorsFilePaths)
{ {
const UpdateVisibleTranslationUnitsMessage message(currentEditorFilePath, visibleEditorsFilePaths); const DocumentVisibilityChangedMessage message(currentEditorFilePath, visibleEditorsFilePaths);
m_sender->updateVisibleTranslationUnits(message); m_sender->documentVisibilityChanged(message);
} }
void BackendCommunicator::registerCurrentProjectParts() void BackendCommunicator::projectPartsUpdatedForCurrentProjects()
{ {
using namespace CppTools; using namespace CppTools;
const QList<ProjectInfo> projectInfos = CppModelManager::instance()->projectInfos(); const QList<ProjectInfo> projectInfos = CppModelManager::instance()->projectInfos();
foreach (const ProjectInfo &projectInfo, projectInfos) foreach (const ProjectInfo &projectInfo, projectInfos)
registerProjectsParts(projectInfo.projectParts()); projectPartsUpdated(projectInfo.projectParts());
} }
void BackendCommunicator::restoreCppEditorDocuments() void BackendCommunicator::restoreCppEditorDocuments()
{ {
resetCppEditorDocumentProcessors(); resetCppEditorDocumentProcessors();
registerVisibleCppEditorDocumentAndMarkInvisibleDirty(); CppTools::CppModelManager::instance()->updateCppEditorDocuments();
} }
void BackendCommunicator::resetCppEditorDocumentProcessors() void BackendCommunicator::resetCppEditorDocumentProcessors()
@@ -273,12 +277,7 @@ void BackendCommunicator::resetCppEditorDocumentProcessors()
cppEditorDocument->resetProcessor(); cppEditorDocument->resetProcessor();
} }
void BackendCommunicator::registerVisibleCppEditorDocumentAndMarkInvisibleDirty() void BackendCommunicator::unsavedFilesUpdatedForUiHeaders()
{
CppTools::CppModelManager::instance()->updateCppEditorDocuments();
}
void BackendCommunicator::registerCurrentCodeModelUiHeaders()
{ {
using namespace CppTools; using namespace CppTools;
@@ -286,49 +285,51 @@ void BackendCommunicator::registerCurrentCodeModelUiHeaders()
foreach (const AbstractEditorSupport *es, editorSupports) { foreach (const AbstractEditorSupport *es, editorSupports) {
const QString mappedPath const QString mappedPath
= ModelManagerSupportClang::instance()->dummyUiHeaderOnDiskPath(es->fileName()); = ModelManagerSupportClang::instance()->dummyUiHeaderOnDiskPath(es->fileName());
updateUnsavedFile(mappedPath, es->contents(), es->revision()); unsavedFilesUpdated(mappedPath, es->contents(), es->revision());
} }
} }
void BackendCommunicator::registerProjectsParts(const QVector<CppTools::ProjectPart::Ptr> projectParts) void BackendCommunicator::projectPartsUpdated(const QVector<CppTools::ProjectPart::Ptr> projectParts)
{ {
const auto projectPartContainers = toProjectPartContainers(projectParts); const auto projectPartContainers = toProjectPartContainers(projectParts);
registerProjectPartsForEditor(projectPartContainers); projectPartsUpdated(projectPartContainers);
} }
void BackendCommunicator::updateTranslationUnitFromCppEditorDocument(const QString &filePath) void BackendCommunicator::documentsChangedFromCppEditorDocument(const QString &filePath)
{ {
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath); const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
updateTranslationUnit(filePath, document->contents(), document->revision()); documentsChanged(filePath, document->contents(), document->revision());
} }
void BackendCommunicator::updateUnsavedFileFromCppEditorDocument(const QString &filePath) void BackendCommunicator::unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath)
{ {
const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath); const CppTools::CppEditorDocumentHandle *document = ClangCodeModel::Utils::cppDocument(filePath);
updateUnsavedFile(filePath, document->contents(), document->revision()); unsavedFilesUpdated(filePath, document->contents(), document->revision());
} }
void BackendCommunicator::updateTranslationUnit(const QString &filePath, void BackendCommunicator::documentsChanged(const QString &filePath,
const QByteArray &contents, const QByteArray &contents,
uint documentRevision) uint documentRevision)
{ {
const bool hasUnsavedContent = true; const bool hasUnsavedContent = true;
updateTranslationUnitsForEditor({{filePath, documentsChanged({{filePath,
Utf8String(), Utf8String(),
Utf8String::fromByteArray(contents), Utf8String::fromByteArray(contents),
hasUnsavedContent, hasUnsavedContent,
documentRevision}}); documentRevision}});
} }
void BackendCommunicator::updateUnsavedFile(const QString &filePath, const QByteArray &contents, uint documentRevision) void BackendCommunicator::unsavedFilesUpdated(const QString &filePath,
const QByteArray &contents,
uint documentRevision)
{ {
const bool hasUnsavedContent = true; const bool hasUnsavedContent = true;
// TODO: Send new only if changed // TODO: Send new only if changed
registerUnsavedFilesForEditor({{filePath, unsavedFilesUpdated({{filePath,
Utf8String(), Utf8String(),
Utf8String::fromByteArray(contents), Utf8String::fromByteArray(contents),
hasUnsavedContent, hasUnsavedContent,
@@ -349,19 +350,19 @@ static void setLastSentDocumentRevision(const QString &filePath, uint revision)
document->sendTracker().setLastSentRevision(int(revision)); document->sendTracker().setLastSentRevision(int(revision));
} }
void BackendCommunicator::updateTranslationUnitWithRevisionCheck(const FileContainer &fileContainer) void BackendCommunicator::documentsChangedWithRevisionCheck(const FileContainer &fileContainer)
{ {
if (documentHasChanged(fileContainer.filePath, fileContainer.documentRevision)) { if (documentHasChanged(fileContainer.filePath, fileContainer.documentRevision)) {
updateTranslationUnitsForEditor({fileContainer}); documentsChanged({fileContainer});
setLastSentDocumentRevision(fileContainer.filePath, setLastSentDocumentRevision(fileContainer.filePath,
fileContainer.documentRevision); fileContainer.documentRevision);
} }
} }
void BackendCommunicator::requestDocumentAnnotations(const FileContainer &fileContainer) void BackendCommunicator::requestAnnotations(const FileContainer &fileContainer)
{ {
const RequestDocumentAnnotationsMessage message(fileContainer); const RequestAnnotationsMessage message(fileContainer);
m_sender->requestDocumentAnnotations(message); m_sender->requestAnnotations(message);
} }
QFuture<CppTools::CursorInfo> BackendCommunicator::requestReferences( QFuture<CppTools::CursorInfo> BackendCommunicator::requestReferences(
@@ -401,21 +402,19 @@ QFuture<CppTools::SymbolInfo> BackendCommunicator::requestFollowSymbol(
quint32 line, quint32 line,
quint32 column) quint32 column)
{ {
const RequestFollowSymbolMessage message(curFileContainer, const RequestFollowSymbolMessage message(curFileContainer, line, column);
line,
column);
m_sender->requestFollowSymbol(message); m_sender->requestFollowSymbol(message);
return m_receiver.addExpectedRequestFollowSymbolMessage(message.ticketNumber); return m_receiver.addExpectedRequestFollowSymbolMessage(message.ticketNumber);
} }
void BackendCommunicator::updateTranslationUnitWithRevisionCheck(Core::IDocument *document) void BackendCommunicator::documentsChangedWithRevisionCheck(Core::IDocument *document)
{ {
const auto textDocument = qobject_cast<TextDocument*>(document); const auto textDocument = qobject_cast<TextDocument*>(document);
const auto filePath = textDocument->filePath().toString(); const auto filePath = textDocument->filePath().toString();
const QString projectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath); const QString projectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
updateTranslationUnitWithRevisionCheck(FileContainer(filePath, documentsChangedWithRevisionCheck(FileContainer(filePath,
projectPartId, projectPartId,
Utf8StringVector(), Utf8StringVector(),
textDocument->document()->revision())); textDocument->document()->revision()));
@@ -427,23 +426,23 @@ void BackendCommunicator::updateChangeContentStartPosition(const QString &filePa
document->sendTracker().applyContentChange(position); document->sendTracker().applyContentChange(position);
} }
void BackendCommunicator::updateTranslationUnitIfNotCurrentDocument(Core::IDocument *document) void BackendCommunicator::documentsChangedIfNotCurrentDocument(Core::IDocument *document)
{ {
QTC_ASSERT(document, return); QTC_ASSERT(document, return);
if (Core::EditorManager::currentDocument() != document) if (Core::EditorManager::currentDocument() != document)
updateTranslationUnit(document); documentsChanged(document);
} }
void BackendCommunicator::updateTranslationUnit(Core::IDocument *document) void BackendCommunicator::documentsChanged(Core::IDocument *document)
{ {
updateTranslationUnitFromCppEditorDocument(document->filePath().toString()); documentsChangedFromCppEditorDocument(document->filePath().toString());
} }
void BackendCommunicator::updateUnsavedFile(Core::IDocument *document) void BackendCommunicator::unsavedFilesUpdated(Core::IDocument *document)
{ {
QTC_ASSERT(document, return); QTC_ASSERT(document, return);
updateUnsavedFileFromCppEditorDocument(document->filePath().toString()); unsavedFielsUpdatedFromCppEditorDocument(document->filePath().toString());
} }
void BackendCommunicator::onConnectedToBackend() void BackendCommunicator::onConnectedToBackend()
@@ -511,59 +510,59 @@ void BackendCommunicator::logError(const QString &text)
void BackendCommunicator::initializeBackendWithCurrentData() void BackendCommunicator::initializeBackendWithCurrentData()
{ {
registerFallbackProjectPart(); projectPartsUpdatedForFallback();
registerCurrentProjectParts(); projectPartsUpdatedForCurrentProjects();
registerCurrentCodeModelUiHeaders(); unsavedFilesUpdatedForUiHeaders();
restoreCppEditorDocuments(); restoreCppEditorDocuments();
updateTranslationUnitVisiblity(); documentVisibilityChanged();
} }
void BackendCommunicator::registerTranslationUnitsForEditor(const FileContainers &fileContainers) void BackendCommunicator::documentsOpened(const FileContainers &fileContainers)
{ {
const RegisterTranslationUnitForEditorMessage message(fileContainers, const DocumentsOpenedMessage message(fileContainers,
currentCppEditorDocumentFilePath(), currentCppEditorDocumentFilePath(),
visibleCppEditorDocumentsFilePaths()); visibleCppEditorDocumentsFilePaths());
m_sender->registerTranslationUnitsForEditor(message); m_sender->documentsOpened(message);
} }
void BackendCommunicator::updateTranslationUnitsForEditor(const FileContainers &fileContainers) void BackendCommunicator::documentsChanged(const FileContainers &fileContainers)
{ {
const UpdateTranslationUnitsForEditorMessage message(fileContainers); const DocumentsChangedMessage message(fileContainers);
m_sender->updateTranslationUnitsForEditor(message); m_sender->documentsChanged(message);
} }
void BackendCommunicator::unregisterTranslationUnitsForEditor(const FileContainers &fileContainers) void BackendCommunicator::documentsClosed(const FileContainers &fileContainers)
{ {
const UnregisterTranslationUnitsForEditorMessage message(fileContainers); const DocumentsClosedMessage message(fileContainers);
m_sender->unregisterTranslationUnitsForEditor(message); m_sender->documentsClosed(message);
} }
void BackendCommunicator::registerProjectPartsForEditor( void BackendCommunicator::projectPartsUpdated(
const ProjectPartContainers &projectPartContainers) const ProjectPartContainers &projectPartContainers)
{ {
const RegisterProjectPartsForEditorMessage message(projectPartContainers); const ProjectPartsUpdatedMessage message(projectPartContainers);
m_sender->registerProjectPartsForEditor(message); m_sender->projectPartsUpdated(message);
} }
void BackendCommunicator::unregisterProjectPartsForEditor(const QStringList &projectPartIds) void BackendCommunicator::projectPartsRemoved(const QStringList &projectPartIds)
{ {
const UnregisterProjectPartsForEditorMessage message((Utf8StringVector(projectPartIds))); const ProjectPartsRemovedMessage message((Utf8StringVector(projectPartIds)));
m_sender->unregisterProjectPartsForEditor(message); m_sender->projectPartsRemoved(message);
} }
void BackendCommunicator::registerUnsavedFilesForEditor(const FileContainers &fileContainers) void BackendCommunicator::unsavedFilesUpdated(const FileContainers &fileContainers)
{ {
const RegisterUnsavedFilesForEditorMessage message(fileContainers); const UnsavedFilesUpdatedMessage message(fileContainers);
m_sender->registerUnsavedFilesForEditor(message); m_sender->unsavedFilesUpdated(message);
} }
void BackendCommunicator::unregisterUnsavedFilesForEditor(const FileContainers &fileContainers) void BackendCommunicator::unsavedFilesRemoved(const FileContainers &fileContainers)
{ {
const UnregisterUnsavedFilesForEditorMessage message(fileContainers); const UnsavedFilesRemovedMessage message(fileContainers);
m_sender->unregisterUnsavedFilesForEditor(message); m_sender->unsavedFilesRemoved(message);
} }
void BackendCommunicator::completeCode(ClangCompletionAssistProcessor *assistProcessor, void BackendCommunicator::requestCompletions(ClangCompletionAssistProcessor *assistProcessor,
const QString &filePath, const QString &filePath,
quint32 line, quint32 line,
quint32 column, quint32 column,
@@ -571,10 +570,14 @@ void BackendCommunicator::completeCode(ClangCompletionAssistProcessor *assistPro
qint32 funcNameStartLine, qint32 funcNameStartLine,
qint32 funcNameStartColumn) qint32 funcNameStartColumn)
{ {
const CompleteCodeMessage message(filePath, line, column, projectFilePath, funcNameStartLine, const RequestCompletionsMessage message(filePath,
line,
column,
projectFilePath,
funcNameStartLine,
funcNameStartColumn); funcNameStartColumn);
m_sender->completeCode(message); m_sender->requestCompletions(message);
m_receiver.addExpectedCodeCompletedMessage(message.ticketNumber, assistProcessor); m_receiver.addExpectedCompletionsMessage(message.ticketNumber, assistProcessor);
} }
} // namespace Internal } // namespace Internal

View File

@@ -63,14 +63,40 @@ public:
BackendCommunicator(); BackendCommunicator();
~BackendCommunicator(); ~BackendCommunicator();
void registerTranslationUnitsForEditor(const FileContainers &fileContainers); void documentsOpened(const FileContainers &fileContainers);
void updateTranslationUnitsForEditor(const FileContainers &fileContainers); void documentsChanged(Core::IDocument *document);
void unregisterTranslationUnitsForEditor(const FileContainers &fileContainers); void documentsChanged(const QString &filePath,
void registerProjectPartsForEditor(const ProjectPartContainers &projectPartContainers); const QByteArray &contents,
void unregisterProjectPartsForEditor(const QStringList &projectPartIds); uint documentRevision);
void registerUnsavedFilesForEditor(const FileContainers &fileContainers); void documentsChanged(const FileContainers &fileContainers);
void unregisterUnsavedFilesForEditor(const FileContainers &fileContainers); void documentsChangedFromCppEditorDocument(const QString &filePath);
void requestDocumentAnnotations(const ClangBackEnd::FileContainer &fileContainer); void documentsChangedIfNotCurrentDocument(Core::IDocument *document);
void documentsChangedWithRevisionCheck(const ClangBackEnd::FileContainer &fileContainer);
void documentsChangedWithRevisionCheck(Core::IDocument *document);
void documentsClosed(const FileContainers &fileContainers);
void documentVisibilityChanged();
void projectPartsUpdated(const QVector<CppTools::ProjectPart::Ptr> projectParts);
void projectPartsUpdated(const ProjectPartContainers &projectPartContainers);
void projectPartsUpdatedForFallback();
void projectPartsRemoved(const QStringList &projectPartIds);
void unsavedFilesUpdated(Core::IDocument *document);
void unsavedFilesUpdated(const QString &filePath,
const QByteArray &contents,
uint documentRevision);
void unsavedFilesUpdated(const FileContainers &fileContainers);
void unsavedFielsUpdatedFromCppEditorDocument(const QString &filePath);
void unsavedFilesRemoved(const FileContainers &fileContainers);
void requestCompletions(ClangCompletionAssistProcessor *assistProcessor,
const QString &filePath,
quint32 line,
quint32 column,
const QString &projectFilePath,
qint32 funcNameStartLine = -1,
qint32 funcNameStartColumn = -1);
void requestAnnotations(const ClangBackEnd::FileContainer &fileContainer);
QFuture<CppTools::CursorInfo> requestReferences( QFuture<CppTools::CursorInfo> requestReferences(
const FileContainer &fileContainer, const FileContainer &fileContainer,
quint32 line, quint32 line,
@@ -86,39 +112,17 @@ public:
QFuture<CppTools::SymbolInfo> requestFollowSymbol(const FileContainer &curFileContainer, QFuture<CppTools::SymbolInfo> requestFollowSymbol(const FileContainer &curFileContainer,
quint32 line, quint32 line,
quint32 column); quint32 column);
void completeCode(ClangCompletionAssistProcessor *assistProcessor, const QString &filePath,
quint32 line,
quint32 column,
const QString &projectFilePath,
qint32 funcNameStartLine = -1,
qint32 funcNameStartColumn = -1);
void registerProjectsParts(const QVector<CppTools::ProjectPart::Ptr> projectParts);
void updateTranslationUnitIfNotCurrentDocument(Core::IDocument *document);
void updateTranslationUnit(Core::IDocument *document);
void updateUnsavedFile(Core::IDocument *document);
void updateTranslationUnitFromCppEditorDocument(const QString &filePath);
void updateUnsavedFileFromCppEditorDocument(const QString &filePath);
void updateTranslationUnit(const QString &filePath, const QByteArray &contents, uint documentRevision);
void updateUnsavedFile(const QString &filePath, const QByteArray &contents, uint documentRevision);
void updateTranslationUnitWithRevisionCheck(const ClangBackEnd::FileContainer &fileContainer);
void updateTranslationUnitWithRevisionCheck(Core::IDocument *document);
void updateChangeContentStartPosition(const QString &filePath, int position); void updateChangeContentStartPosition(const QString &filePath, int position);
void registerFallbackProjectPart();
void updateTranslationUnitVisiblity();
bool isNotWaitingForCompletion() const; bool isNotWaitingForCompletion() const;
private: private:
void initializeBackend(); void initializeBackend();
void initializeBackendWithCurrentData(); void initializeBackendWithCurrentData();
void registerCurrentProjectParts(); void projectPartsUpdatedForCurrentProjects();
void restoreCppEditorDocuments(); void restoreCppEditorDocuments();
void resetCppEditorDocumentProcessors(); void resetCppEditorDocumentProcessors();
void registerVisibleCppEditorDocumentAndMarkInvisibleDirty(); void unsavedFilesUpdatedForUiHeaders();
void registerCurrentCodeModelUiHeaders();
void setupDummySender(); void setupDummySender();
@@ -131,7 +135,7 @@ private:
void logStartTimeOut(); void logStartTimeOut();
void logError(const QString &text); void logError(const QString &text);
void updateTranslationUnitVisiblity(const Utf8String &currentEditorFilePath, void documentVisibilityChanged(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorsFilePaths); const Utf8StringVector &visibleEditorsFilePaths);
private: private:

View File

@@ -77,7 +77,7 @@ void BackendReceiver::setAliveHandler(const BackendReceiver::AliveHandler &handl
m_aliveHandler = handler; m_aliveHandler = handler;
} }
void BackendReceiver::addExpectedCodeCompletedMessage( void BackendReceiver::addExpectedCompletionsMessage(
quint64 ticket, quint64 ticket,
ClangCompletionAssistProcessor *processor) ClangCompletionAssistProcessor *processor)
{ {
@@ -138,7 +138,7 @@ QFuture<CppTools::ToolTipInfo> BackendReceiver::addExpectedToolTipMessage(quint6
return futureInterface.future(); return futureInterface.future();
} }
bool BackendReceiver::isExpectingCodeCompletedMessage() const bool BackendReceiver::isExpectingCompletionsMessage() const
{ {
return !m_assistProcessorsTable.isEmpty(); return !m_assistProcessorsTable.isEmpty();
} }
@@ -180,9 +180,9 @@ void BackendReceiver::echo(const EchoMessage &message)
qCDebugIpc() << message; qCDebugIpc() << message;
} }
void BackendReceiver::codeCompleted(const CodeCompletedMessage &message) void BackendReceiver::completions(const CompletionsMessage &message)
{ {
qCDebugIpc() << "CodeCompletedMessage with" << message.codeCompletions.size() qCDebugIpc() << "CompletionsMessage with" << message.codeCompletions.size()
<< "items"; << "items";
const quint64 ticket = message.ticketNumber; const quint64 ticket = message.ticketNumber;
@@ -193,9 +193,9 @@ void BackendReceiver::codeCompleted(const CodeCompletedMessage &message)
} }
} }
void BackendReceiver::documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) void BackendReceiver::annotations(const AnnotationsMessage &message)
{ {
qCDebugIpc() << "DocumentAnnotationsChangedMessage with" qCDebugIpc() << "AnnotationsMessage with"
<< message.diagnostics.size() << "diagnostics" << message.diagnostics.size() << "diagnostics"
<< message.tokenInfos.size() << "highlighting marks" << message.tokenInfos.size() << "highlighting marks"
<< message.skippedPreprocessorRanges.size() << "skipped preprocessor ranges"; << message.skippedPreprocessorRanges.size() << "skipped preprocessor ranges";
@@ -255,7 +255,7 @@ static
CppTools::SymbolInfo toSymbolInfo(const FollowSymbolMessage &message) CppTools::SymbolInfo toSymbolInfo(const FollowSymbolMessage &message)
{ {
CppTools::SymbolInfo result; CppTools::SymbolInfo result;
const SourceRangeContainer &range = message.sourceRange; const SourceRangeContainer &range = message.result.range;
const SourceLocationContainer &start = range.start; const SourceLocationContainer &start = range.start;
const SourceLocationContainer &end = range.end; const SourceLocationContainer &end = range.end;
@@ -265,6 +265,8 @@ CppTools::SymbolInfo toSymbolInfo(const FollowSymbolMessage &message)
result.endColumn = static_cast<int>(end.column); result.endColumn = static_cast<int>(end.column);
result.fileName = start.filePath; result.fileName = start.filePath;
result.isPureDeclarationForUsage = message.result.isPureDeclarationForUsage;
return result; return result;
} }
@@ -354,7 +356,7 @@ void BackendReceiver::tooltip(const ToolTipMessage &message)
void BackendReceiver::followSymbol(const ClangBackEnd::FollowSymbolMessage &message) void BackendReceiver::followSymbol(const ClangBackEnd::FollowSymbolMessage &message)
{ {
qCDebugIpc() << "FollowSymbolMessage with" qCDebugIpc() << "FollowSymbolMessage with"
<< message.sourceRange << "range"; << message.result;
const quint64 ticket = message.ticketNumber; const quint64 ticket = message.ticketNumber;
QFutureInterface<CppTools::SymbolInfo> futureInterface = m_followTable.take(ticket); QFutureInterface<CppTools::SymbolInfo> futureInterface = m_followTable.take(ticket);

View File

@@ -51,7 +51,7 @@ public:
using AliveHandler = std::function<void ()>; using AliveHandler = std::function<void ()>;
void setAliveHandler(const AliveHandler &handler); void setAliveHandler(const AliveHandler &handler);
void addExpectedCodeCompletedMessage(quint64 ticket, ClangCompletionAssistProcessor *processor); void addExpectedCompletionsMessage(quint64 ticket, ClangCompletionAssistProcessor *processor);
void deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget); void deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget);
QFuture<CppTools::CursorInfo> QFuture<CppTools::CursorInfo>
@@ -60,16 +60,16 @@ public:
= CppTools::SemanticInfo::LocalUseMap()); = CppTools::SemanticInfo::LocalUseMap());
QFuture<CppTools::SymbolInfo> addExpectedRequestFollowSymbolMessage(quint64 ticket); QFuture<CppTools::SymbolInfo> addExpectedRequestFollowSymbolMessage(quint64 ticket);
QFuture<CppTools::ToolTipInfo> addExpectedToolTipMessage(quint64 ticket); QFuture<CppTools::ToolTipInfo> addExpectedToolTipMessage(quint64 ticket);
bool isExpectingCodeCompletedMessage() const; bool isExpectingCompletionsMessage() const;
void reset(); void reset();
private: private:
void alive() override; void alive() override;
void echo(const ClangBackEnd::EchoMessage &message) override; void echo(const ClangBackEnd::EchoMessage &message) override;
void codeCompleted(const ClangBackEnd::CodeCompletedMessage &message) override; void completions(const ClangBackEnd::CompletionsMessage &message) override;
void documentAnnotationsChanged(const ClangBackEnd::DocumentAnnotationsChangedMessage &message) override; void annotations(const ClangBackEnd::AnnotationsMessage &message) override;
void references(const ClangBackEnd::ReferencesMessage &message) override; void references(const ClangBackEnd::ReferencesMessage &message) override;
void tooltip(const ClangBackEnd::ToolTipMessage &message) override; void tooltip(const ClangBackEnd::ToolTipMessage &message) override;
void followSymbol(const ClangBackEnd::FollowSymbolMessage &message) override; void followSymbol(const ClangBackEnd::FollowSymbolMessage &message) override;

View File

@@ -50,67 +50,67 @@ void BackendSender::end()
m_connection->sendEndMessage(); m_connection->sendEndMessage();
} }
void BackendSender::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) void BackendSender::documentsOpened(const DocumentsOpenedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().registerTranslationUnitsForEditor(message); m_connection->serverProxy().documentsOpened(message);
} }
void BackendSender::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) void BackendSender::documentsChanged(const DocumentsChangedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().updateTranslationUnitsForEditor(message); m_connection->serverProxy().documentsChanged(message);
} }
void BackendSender::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) void BackendSender::documentsClosed(const DocumentsClosedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().unregisterTranslationUnitsForEditor(message); m_connection->serverProxy().documentsClosed(message);
} }
void BackendSender::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) void BackendSender::projectPartsUpdated(const ProjectPartsUpdatedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().registerProjectPartsForEditor(message); m_connection->serverProxy().projectPartsUpdated(message);
} }
void BackendSender::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) void BackendSender::projectPartsRemoved(const ProjectPartsRemovedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().unregisterProjectPartsForEditor(message); m_connection->serverProxy().projectPartsRemoved(message);
} }
void BackendSender::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) void BackendSender::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().registerUnsavedFilesForEditor(message); m_connection->serverProxy().unsavedFilesUpdated(message);
} }
void BackendSender::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) void BackendSender::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().unregisterUnsavedFilesForEditor(message); m_connection->serverProxy().unsavedFilesRemoved(message);
} }
void BackendSender::completeCode(const CompleteCodeMessage &message) void BackendSender::requestCompletions(const RequestCompletionsMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().completeCode(message); m_connection->serverProxy().requestCompletions(message);
} }
void BackendSender::requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) void BackendSender::requestAnnotations(const RequestAnnotationsMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().requestDocumentAnnotations(message); m_connection->serverProxy().requestAnnotations(message);
} }
void BackendSender::requestReferences(const RequestReferencesMessage &message) void BackendSender::requestReferences(const RequestReferencesMessage &message)
@@ -134,11 +134,11 @@ void BackendSender::requestFollowSymbol(const RequestFollowSymbolMessage &messag
m_connection->serverProxy().requestFollowSymbol(message); m_connection->serverProxy().requestFollowSymbol(message);
} }
void BackendSender::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) void BackendSender::documentVisibilityChanged(const DocumentVisibilityChangedMessage &message)
{ {
QTC_CHECK(m_connection->isConnected()); QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message; qCDebugIpc() << message;
m_connection->serverProxy().updateVisibleTranslationUnits(message); m_connection->serverProxy().documentVisibilityChanged(message);
} }
} // namespace Internal } // namespace Internal

View File

@@ -38,19 +38,23 @@ public:
BackendSender(ClangBackEnd::ClangCodeModelConnectionClient *connectionClient); BackendSender(ClangBackEnd::ClangCodeModelConnectionClient *connectionClient);
void end() override; void end() override;
void registerTranslationUnitsForEditor(const ClangBackEnd::RegisterTranslationUnitForEditorMessage &message) override;
void updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message) override; void documentsOpened(const ClangBackEnd::DocumentsOpenedMessage &message) override;
void unregisterTranslationUnitsForEditor(const ClangBackEnd::UnregisterTranslationUnitsForEditorMessage &message) override; void documentsChanged(const ClangBackEnd::DocumentsChangedMessage &message) override;
void registerProjectPartsForEditor(const ClangBackEnd::RegisterProjectPartsForEditorMessage &message) override; void documentsClosed(const ClangBackEnd::DocumentsClosedMessage &message) override;
void unregisterProjectPartsForEditor(const ClangBackEnd::UnregisterProjectPartsForEditorMessage &message) override; void documentVisibilityChanged(const ClangBackEnd::DocumentVisibilityChangedMessage &message) override;
void registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message) override;
void unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message) override; void projectPartsUpdated(const ClangBackEnd::ProjectPartsUpdatedMessage &message) override;
void completeCode(const ClangBackEnd::CompleteCodeMessage &message) override; void projectPartsRemoved(const ClangBackEnd::ProjectPartsRemovedMessage &message) override;
void requestDocumentAnnotations(const ClangBackEnd::RequestDocumentAnnotationsMessage &message) override;
void unsavedFilesUpdated(const ClangBackEnd::UnsavedFilesUpdatedMessage &message) override;
void unsavedFilesRemoved(const ClangBackEnd::UnsavedFilesRemovedMessage &message) override;
void requestCompletions(const ClangBackEnd::RequestCompletionsMessage &message) override;
void requestAnnotations(const ClangBackEnd::RequestAnnotationsMessage &message) override;
void requestReferences(const ClangBackEnd::RequestReferencesMessage &message) override; void requestReferences(const ClangBackEnd::RequestReferencesMessage &message) override;
void requestToolTip(const ClangBackEnd::RequestToolTipMessage &message) override; void requestToolTip(const ClangBackEnd::RequestToolTipMessage &message) override;
void requestFollowSymbol(const ClangBackEnd::RequestFollowSymbolMessage &message) override; void requestFollowSymbol(const ClangBackEnd::RequestFollowSymbolMessage &message) override;
void updateVisibleTranslationUnits(const ClangBackEnd::UpdateVisibleTranslationUnitsMessage &message) override;
private: private:
ClangBackEnd::ClangCodeModelConnectionClient *m_connection = nullptr; ClangBackEnd::ClangCodeModelConnectionClient *m_connection = nullptr;

View File

@@ -494,7 +494,7 @@ void ClangCompletionAssistProcessor::sendFileContent(const QByteArray &customFil
const UnsavedFileContentInfo info = unsavedFileContent(customFileContent); const UnsavedFileContentInfo info = unsavedFileContent(customFileContent);
BackendCommunicator &communicator = m_interface->communicator(); BackendCommunicator &communicator = m_interface->communicator();
communicator.updateTranslationUnitsForEditor({{m_interface->fileName(), communicator.documentsChanged({{m_interface->fileName(),
Utf8String(), Utf8String(),
Utf8String::fromByteArray(info.unsavedContent), Utf8String::fromByteArray(info.unsavedContent),
info.isDocumentModified, info.isDocumentModified,
@@ -577,9 +577,13 @@ bool ClangCompletionAssistProcessor::sendCompletionRequest(int position,
const Position cursorPosition = extractLineColumn(position); const Position cursorPosition = extractLineColumn(position);
const Position functionNameStart = extractLineColumn(functionNameStartPosition); const Position functionNameStart = extractLineColumn(functionNameStartPosition);
const QString projectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath); const QString projectPartId = CppTools::CppToolsBridge::projectPartIdForFile(filePath);
communicator.completeCode(this, filePath, uint(cursorPosition.line), communicator.requestCompletions(this,
uint(cursorPosition.column), projectPartId, filePath,
functionNameStart.line, functionNameStart.column); uint(cursorPosition.line),
uint(cursorPosition.column),
projectPartId,
functionNameStart.line,
functionNameStart.column);
setLastCompletionPosition(filePath, position); setLastCompletionPosition(filePath, position);
return true; return true;
} }

View File

@@ -28,6 +28,8 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cpptoolsconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/tooltip/tooltip.h> #include <utils/tooltip/tooltip.h>
@@ -46,14 +48,8 @@ namespace {
// CLANG-UPGRADE-CHECK: Checks/update URLs. // CLANG-UPGRADE-CHECK: Checks/update URLs.
// //
// For tidy, upgrade the version in the URL. Note that we cannot use the macro // Once it gets dedicated documentation pages for released versions,
// CLANG_VERSION here because it might denote a version that was not yet
// released (e.g. 6.0.1, but only 6.0.0 was released).
//
// For clazy, once it gets dedicated documentation pages for released versions,
// use them instead of pointing to master, as checks might vanish. // use them instead of pointing to master, as checks might vanish.
const char TIDY_DOCUMENTATION_URL_TEMPLATE[]
= "https://releases.llvm.org/6.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html";
const char CLAZY_DOCUMENTATION_URL_TEMPLATE[] const char CLAZY_DOCUMENTATION_URL_TEMPLATE[]
= "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md"; = "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md";
@@ -283,7 +279,7 @@ private:
return QString(); return QString();
// Clang-Tidy // Clang-Tidy
return QString::fromUtf8(TIDY_DOCUMENTATION_URL_TEMPLATE).arg(option); return QString::fromUtf8(CppTools::Constants::TIDY_DOCUMENTATION_URL_TEMPLATE).arg(option);
} }
static QString maybeClickableOption(const Utf8String &option) static QString maybeClickableOption(const Utf8String &option)

View File

@@ -88,7 +88,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
m_updateTranslationUnitTimer.setSingleShot(true); m_updateTranslationUnitTimer.setSingleShot(true);
m_updateTranslationUnitTimer.setInterval(350); m_updateTranslationUnitTimer.setInterval(350);
connect(&m_updateTranslationUnitTimer, &QTimer::timeout, connect(&m_updateTranslationUnitTimer, &QTimer::timeout,
this, &ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists); this, &ClangEditorDocumentProcessor::updateBackendDocumentIfProjectPartExists);
connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated, connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated,
this, &BaseEditorDocumentProcessor::projectPartInfoUpdated); this, &BaseEditorDocumentProcessor::projectPartInfoUpdated);
@@ -109,7 +109,7 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
m_parserWatcher.waitForFinished(); m_parserWatcher.waitForFinished();
if (m_projectPart) if (m_projectPart)
unregisterTranslationUnitForEditor(); closeBackendDocument();
} }
void ClangEditorDocumentProcessor::runImpl( void ClangEditorDocumentProcessor::runImpl(
@@ -143,7 +143,7 @@ void ClangEditorDocumentProcessor::semanticRehighlight()
m_semanticHighlighter.updateFormatMapFromFontSettings(); m_semanticHighlighter.updateFormatMapFromFontSettings();
if (m_projectPart) if (m_projectPart)
requestDocumentAnnotations(m_projectPart->id()); requestAnnotationsFromBackend(m_projectPart->id());
} }
CppTools::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo() CppTools::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo()
@@ -427,12 +427,12 @@ static bool isProjectPartLoadedOrIsFallback(CppTools::ProjectPart::Ptr projectPa
&& (projectPart->id().isEmpty() || ClangCodeModel::Utils::isProjectPartLoaded(projectPart)); && (projectPart->id().isEmpty() || ClangCodeModel::Utils::isProjectPartLoaded(projectPart));
} }
void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor() void ClangEditorDocumentProcessor::updateBackendProjectPartAndDocument()
{ {
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPartInfo().projectPart; const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPartInfo().projectPart;
if (isProjectPartLoadedOrIsFallback(projectPart)) { if (isProjectPartLoadedOrIsFallback(projectPart)) {
registerTranslationUnitForEditor(*projectPart.data()); updateBackendDocument(*projectPart.data());
m_projectPart = projectPart; m_projectPart = projectPart;
m_isProjectFile = m_parser->projectPartInfo().hints m_isProjectFile = m_parser->projectPartInfo().hints
@@ -445,7 +445,7 @@ void ClangEditorDocumentProcessor::onParserFinished()
if (revision() != m_parserRevision) if (revision() != m_parserRevision)
return; return;
updateProjectPartAndTranslationUnitForEditor(); updateBackendProjectPartAndDocument();
} }
namespace { namespace {
@@ -592,7 +592,7 @@ private:
}; };
} // namespace } // namespace
void ClangEditorDocumentProcessor::registerTranslationUnitForEditor( void ClangEditorDocumentProcessor::updateBackendDocument(
CppTools::ProjectPart &projectPart) CppTools::ProjectPart &projectPart)
{ {
// On registration we send the document content immediately as an unsaved // On registration we send the document content immediately as an unsaved
@@ -611,32 +611,31 @@ void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(
const FileOptionsBuilder fileOptions(filePath(), projectPart); const FileOptionsBuilder fileOptions(filePath(), projectPart);
m_diagnosticConfigId = fileOptions.diagnosticConfigId(); m_diagnosticConfigId = fileOptions.diagnosticConfigId();
m_communicator.registerTranslationUnitsForEditor( m_communicator.documentsOpened(
{fileContainerWithOptionsAndDocumentContent(projectPart, fileOptions.options())}); {fileContainerWithOptionsAndDocumentContent(projectPart, fileOptions.options())});
ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision()); ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision());
} }
void ClangEditorDocumentProcessor::unregisterTranslationUnitForEditor() void ClangEditorDocumentProcessor::closeBackendDocument()
{ {
QTC_ASSERT(m_projectPart, return); QTC_ASSERT(m_projectPart, return);
m_communicator.unregisterTranslationUnitsForEditor( m_communicator.documentsClosed({ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
} }
void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists() void ClangEditorDocumentProcessor::updateBackendDocumentIfProjectPartExists()
{ {
if (m_projectPart) { if (m_projectPart) {
const ClangBackEnd::FileContainer fileContainer = fileContainerWithDocumentContent(m_projectPart->id()); const ClangBackEnd::FileContainer fileContainer = fileContainerWithDocumentContent(
m_projectPart->id());
m_communicator.updateTranslationUnitWithRevisionCheck(fileContainer); m_communicator.documentsChangedWithRevisionCheck(fileContainer);
} }
} }
void ClangEditorDocumentProcessor::requestDocumentAnnotations(const QString &projectpartId) void ClangEditorDocumentProcessor::requestAnnotationsFromBackend(const QString &projectpartId)
{ {
const auto fileContainer = fileContainerWithDocumentContent(projectpartId); const auto fileContainer = fileContainerWithDocumentContent(projectpartId);
m_communicator.requestDocumentAnnotations(fileContainer); m_communicator.requestAnnotations(fileContainer);
} }
CppTools::BaseEditorDocumentProcessor::HeaderErrorDiagnosticWidgetCreator CppTools::BaseEditorDocumentProcessor::HeaderErrorDiagnosticWidgetCreator

View File

@@ -97,7 +97,7 @@ public:
int line, int line,
int column) override; int column) override;
void unregisterTranslationUnitForEditor(); void closeBackendDocument();
void clearDiagnosticsWithFixIts(); void clearDiagnosticsWithFixIts();
@@ -114,10 +114,12 @@ signals:
private: private:
void onParserFinished(); void onParserFinished();
void updateProjectPartAndTranslationUnitForEditor();
void registerTranslationUnitForEditor(CppTools::ProjectPart &projectPart); void updateBackendProjectPartAndDocument();
void updateTranslationUnitIfProjectPartExists(); void updateBackendDocument(CppTools::ProjectPart &projectPart);
void requestDocumentAnnotations(const QString &projectpartId); void updateBackendDocumentIfProjectPartExists();
void requestAnnotationsFromBackend(const QString &projectpartId);
HeaderErrorDiagnosticWidgetCreator creatorForHeaderErrorDiagnosticWidget( HeaderErrorDiagnosticWidgetCreator creatorForHeaderErrorDiagnosticWidget(
const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic); const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic);
ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const; ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const;

View File

@@ -140,6 +140,19 @@ static Utils::Link linkAtCursor(const QTextCursor &cursor,
return Link(); return Link();
} }
static ::Utils::ProcessLinkCallback extendedCallback(::Utils::ProcessLinkCallback &&callback,
const CppTools::SymbolInfo &result)
{
// If globalFollowSymbol finds nothing follow to the declaration.
return [original_callback = std::move(callback), result](const ::Utils::Link &link) {
if (!link.hasValidTarget() && result.isPureDeclarationForUsage) {
return original_callback(::Utils::Link(result.fileName, result.startLine,
result.startColumn - 1));
}
return original_callback(link);
};
}
void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data, void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
::Utils::ProcessLinkCallback &&processLinkCallback, ::Utils::ProcessLinkCallback &&processLinkCallback,
bool resolveTarget, bool resolveTarget,
@@ -185,11 +198,11 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
return callback(Utils::Link()); return callback(Utils::Link());
CppTools::SymbolInfo result = m_watcher->result(); CppTools::SymbolInfo result = m_watcher->result();
// We did not fail but the result is empty // We did not fail but the result is empty
if (result.fileName.isEmpty()) { if (result.fileName.isEmpty() || result.isPureDeclarationForUsage) {
const CppTools::RefactoringEngineInterface &refactoringEngine const CppTools::RefactoringEngineInterface &refactoringEngine
= *CppTools::CppModelManager::instance(); = *CppTools::CppModelManager::instance();
refactoringEngine.globalFollowSymbol(data, refactoringEngine.globalFollowSymbol(data,
std::move(callback), extendedCallback(std::move(callback), result),
snapshot, snapshot,
documentFromSemanticInfo, documentFromSemanticInfo,
symbolFinder, symbolFinder,

View File

@@ -49,9 +49,9 @@
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <clangsupport/cmbregisterprojectsforeditormessage.h>
#include <clangsupport/filecontainer.h> #include <clangsupport/filecontainer.h>
#include <clangsupport/projectpartcontainer.h> #include <clangsupport/projectpartcontainer.h>
#include <clangsupport/projectpartsupdatedmessage.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -108,7 +108,7 @@ ModelManagerSupportClang::ModelManagerSupportClang()
connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated, connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated,
this, &ModelManagerSupportClang::onDiagnosticConfigsInvalidated); this, &ModelManagerSupportClang::onDiagnosticConfigsInvalidated);
m_communicator.registerFallbackProjectPart(); m_communicator.projectPartsUpdatedForFallback();
} }
ModelManagerSupportClang::~ModelManagerSupportClang() ModelManagerSupportClang::~ModelManagerSupportClang()
@@ -150,7 +150,7 @@ CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::createEditorDoc
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *editor) void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *editor)
{ {
m_communicator.updateTranslationUnitVisiblity(); m_communicator.documentVisibilityChanged();
// Update task hub issues for current CppEditorDocument // Update task hub issues for current CppEditorDocument
ClangEditorDocumentProcessor::clearTaskHubIssues(); ClangEditorDocumentProcessor::clearTaskHubIssues();
@@ -232,7 +232,7 @@ void ModelManagerSupportClang::onEditorOpened(Core::IEditor *editor)
void ModelManagerSupportClang::onEditorClosed(const QList<Core::IEditor *> &) void ModelManagerSupportClang::onEditorClosed(const QList<Core::IEditor *> &)
{ {
m_communicator.updateTranslationUnitVisiblity(); m_communicator.documentVisibilityChanged();
} }
void ModelManagerSupportClang::onCppDocumentAboutToReloadOnTranslationUnit() void ModelManagerSupportClang::onCppDocumentAboutToReloadOnTranslationUnit()
@@ -247,7 +247,7 @@ void ModelManagerSupportClang::onCppDocumentReloadFinishedOnTranslationUnit(bool
if (success) { if (success) {
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(sender()); TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(sender());
connectToTextDocumentContentsChangedForTranslationUnit(textDocument); connectToTextDocumentContentsChangedForTranslationUnit(textDocument);
m_communicator.updateTranslationUnitWithRevisionCheck(textDocument); m_communicator.documentsChangedWithRevisionCheck(textDocument);
} }
} }
@@ -268,7 +268,7 @@ void ModelManagerSupportClang::onCppDocumentContentsChangedOnTranslationUnit(int
m_communicator.updateChangeContentStartPosition(document->filePath().toString(), m_communicator.updateChangeContentStartPosition(document->filePath().toString(),
position); position);
m_communicator.updateTranslationUnitIfNotCurrentDocument(document); m_communicator.documentsChangedIfNotCurrentDocument(document);
clearDiagnosticFixIts(document->filePath().toString()); clearDiagnosticFixIts(document->filePath().toString());
} }
@@ -285,14 +285,14 @@ void ModelManagerSupportClang::onCppDocumentReloadFinishedOnUnsavedFile(bool suc
if (success) { if (success) {
TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(sender()); TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(sender());
connectToTextDocumentContentsChangedForUnsavedFile(textDocument); connectToTextDocumentContentsChangedForUnsavedFile(textDocument);
m_communicator.updateUnsavedFile(textDocument); m_communicator.unsavedFilesUpdated(textDocument);
} }
} }
void ModelManagerSupportClang::onCppDocumentContentsChangedOnUnsavedFile() void ModelManagerSupportClang::onCppDocumentContentsChangedOnUnsavedFile()
{ {
Core::IDocument *document = qobject_cast<Core::IDocument *>(sender()); Core::IDocument *document = qobject_cast<Core::IDocument *>(sender());
m_communicator.updateUnsavedFile(document); m_communicator.unsavedFilesUpdated(document);
} }
void ModelManagerSupportClang::onAbstractEditorSupportContentsUpdated(const QString &filePath, void ModelManagerSupportClang::onAbstractEditorSupportContentsUpdated(const QString &filePath,
@@ -301,7 +301,7 @@ void ModelManagerSupportClang::onAbstractEditorSupportContentsUpdated(const QStr
QTC_ASSERT(!filePath.isEmpty(), return); QTC_ASSERT(!filePath.isEmpty(), return);
const QString mappedPath = m_uiHeaderOnDiskManager.createIfNeeded(filePath); const QString mappedPath = m_uiHeaderOnDiskManager.createIfNeeded(filePath);
m_communicator.updateUnsavedFile(mappedPath, content, 0); m_communicator.unsavedFilesUpdated(mappedPath, content, 0);
} }
void ModelManagerSupportClang::onAbstractEditorSupportRemoved(const QString &filePath) void ModelManagerSupportClang::onAbstractEditorSupportRemoved(const QString &filePath)
@@ -311,7 +311,7 @@ void ModelManagerSupportClang::onAbstractEditorSupportRemoved(const QString &fil
if (!cppModelManager()->cppEditorDocument(filePath)) { if (!cppModelManager()->cppEditorDocument(filePath)) {
const QString mappedPath = m_uiHeaderOnDiskManager.remove(filePath); const QString mappedPath = m_uiHeaderOnDiskManager.remove(filePath);
const QString projectPartId = Utils::projectPartIdForFile(filePath); const QString projectPartId = Utils::projectPartIdForFile(filePath);
m_communicator.unregisterUnsavedFilesForEditor({{mappedPath, projectPartId}}); m_communicator.unsavedFilesRemoved({{mappedPath, projectPartId}});
} }
} }
@@ -411,16 +411,16 @@ void ModelManagerSupportClang::onProjectPartsUpdated(ProjectExplorer::Project *p
const CppTools::ProjectInfo projectInfo = cppModelManager()->projectInfo(project); const CppTools::ProjectInfo projectInfo = cppModelManager()->projectInfo(project);
QTC_ASSERT(projectInfo.isValid(), return); QTC_ASSERT(projectInfo.isValid(), return);
m_communicator.registerProjectsParts(projectInfo.projectParts()); m_communicator.projectPartsUpdated(projectInfo.projectParts());
m_communicator.registerFallbackProjectPart(); m_communicator.projectPartsUpdatedForFallback();
} }
void ModelManagerSupportClang::onProjectPartsRemoved(const QStringList &projectPartIds) void ModelManagerSupportClang::onProjectPartsRemoved(const QStringList &projectPartIds)
{ {
if (!projectPartIds.isEmpty()) { if (!projectPartIds.isEmpty()) {
unregisterTranslationUnitsWithProjectParts(projectPartIds); closeBackendDocumentsWithProjectParts(projectPartIds);
m_communicator.unregisterProjectPartsForEditor(projectPartIds); m_communicator.projectPartsRemoved(projectPartIds);
m_communicator.registerFallbackProjectPart(); m_communicator.projectPartsUpdatedForFallback();
} }
} }
@@ -445,12 +445,12 @@ clangProcessorsWithProjectParts(const QStringList &projectPartIds)
}); });
} }
void ModelManagerSupportClang::unregisterTranslationUnitsWithProjectParts( void ModelManagerSupportClang::closeBackendDocumentsWithProjectParts(
const QStringList &projectPartIds) const QStringList &projectPartIds)
{ {
const auto processors = clangProcessorsWithProjectParts(projectPartIds); const auto processors = clangProcessorsWithProjectParts(projectPartIds);
foreach (ClangEditorDocumentProcessor *processor, processors) { foreach (ClangEditorDocumentProcessor *processor, processors) {
processor->unregisterTranslationUnitForEditor(); processor->closeBackendDocument();
processor->clearProjectPart(); processor->clearProjectPart();
processor->run(); processor->run();
} }

View File

@@ -109,7 +109,7 @@ private:
void onDiagnosticConfigsInvalidated(const QVector<Core::Id> &configIds); void onDiagnosticConfigsInvalidated(const QVector<Core::Id> &configIds);
void unregisterTranslationUnitsWithProjectParts(const QStringList &projectPartIds); void closeBackendDocumentsWithProjectParts(const QStringList &projectPartIds);
void connectTextDocumentToTranslationUnit(TextEditor::TextDocument *textDocument); void connectTextDocumentToTranslationUnit(TextEditor::TextDocument *textDocument);
void connectTextDocumentToUnsavedFiles(TextEditor::TextDocument *textDocument); void connectTextDocumentToUnsavedFiles(TextEditor::TextDocument *textDocument);

View File

@@ -80,6 +80,17 @@ void buildTree(const TokenContainers &containers,
if (lexicalParentIndex >= 0 && treeItemCache[lexicalParentIndex]) if (lexicalParentIndex >= 0 && treeItemCache[lexicalParentIndex])
parent = treeItemCache[lexicalParentIndex]; parent = treeItemCache[lexicalParentIndex];
if (parent != root
&& (container.extraInfo.storageClass == ClangBackEnd::StorageClass::Extern
|| container.extraInfo.storageClass == ClangBackEnd::StorageClass::Static)) {
ClangBackEnd::HighlightingType parentType = parent->token.types.mainHighlightingType;
if (parentType == ClangBackEnd::HighlightingType::VirtualFunction
|| parentType == ClangBackEnd::HighlightingType::Function) {
// Treat static and extern variables inside a function scope as local variables.
continue;
}
}
parent->appendChild(item.release()); parent->appendChild(item.release());
} }
@@ -213,10 +224,20 @@ bool OverviewModel::isGenerated(const QModelIndex &) const
TokenTreeItem *item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex)); TokenTreeItem *item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
if (!item) if (!item)
return {}; return {};
::Utils::LineColumn lineColumn; return ::Utils::LineColumn(static_cast<int>(item->token.line),
lineColumn.line = static_cast<int>(item->token.line); static_cast<int>(item->token.column));
lineColumn.column = static_cast<int>(item->token.column); }
return lineColumn;
OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const
{
TokenTreeItem *item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
if (!item)
return {};
const ClangBackEnd::SourceRangeContainer &range = item->token.extraInfo.cursorRange;
return std::make_pair(::Utils::LineColumn(static_cast<int>(range.start.line),
static_cast<int>(range.start.column)),
::Utils::LineColumn(static_cast<int>(range.end.line),
static_cast<int>(range.end.column)));
} }
} // namespace Internal } // namespace Internal

View File

@@ -61,6 +61,7 @@ public:
bool isGenerated(const QModelIndex &sourceIndex) const override; bool isGenerated(const QModelIndex &sourceIndex) const override;
::Utils::Link linkFromIndex(const QModelIndex &sourceIndex) const override; ::Utils::Link linkFromIndex(const QModelIndex &sourceIndex) const override;
::Utils::LineColumn lineColumnFromIndex(const QModelIndex &sourceIndex) const override; ::Utils::LineColumn lineColumnFromIndex(const QModelIndex &sourceIndex) const override;
Range rangeFromIndex(const QModelIndex &sourceIndex) const override;
private: private:
QString m_filePath; QString m_filePath;
}; };

View File

@@ -31,7 +31,9 @@
#include "clangtoolsutils.h" #include "clangtoolsutils.h"
#include <cpptools/compileroptionsbuilder.h> #include <cpptools/compileroptionsbuilder.h>
#include <cpptools/cppcodemodelsettings.h>
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsreuse.h>
#include <cpptools/projectinfo.h> #include <cpptools/projectinfo.h>
#include <cpptools/projectpart.h> #include <cpptools/projectpart.h>
@@ -265,6 +267,13 @@ private:
enum { GlobalSettings , CustomSettings }; enum { GlobalSettings , CustomSettings };
static Core::Id diagnosticConfiguration(ClangToolsProjectSettings *settings)
{
if (settings->useGlobalSettings())
return ClangToolsSettings::instance()->savedDiagnosticConfigId();
return settings->diagnosticConfig();
}
SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo, SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
const FileInfos &allFileInfos) const FileInfos &allFileInfos)
: QDialog(nullptr) : QDialog(nullptr)
@@ -285,18 +294,15 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project); ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
Core::Id diagnosticConfig;
if (settings->useGlobalSettings()) { if (settings->useGlobalSettings()) {
m_ui->globalOrCustom->setCurrentIndex(GlobalSettings); m_ui->globalOrCustom->setCurrentIndex(GlobalSettings);
m_ui->diagnosticConfigsSelectionWidget->setEnabled(false); m_ui->diagnosticConfigsSelectionWidget->setEnabled(false);
diagnosticConfig = ClangToolsSettings::instance()->savedDiagnosticConfigId();
} else { } else {
m_ui->globalOrCustom->setCurrentIndex(CustomSettings); m_ui->globalOrCustom->setCurrentIndex(CustomSettings);
m_ui->diagnosticConfigsSelectionWidget->setEnabled(true); m_ui->diagnosticConfigsSelectionWidget->setEnabled(true);
diagnosticConfig = settings->diagnosticConfig();
} }
m_customDiagnosticConfig = diagnosticConfig; m_customDiagnosticConfig = diagnosticConfiguration(settings);
m_ui->diagnosticConfigsSelectionWidget->refresh(diagnosticConfig); m_ui->diagnosticConfigsSelectionWidget->refresh(m_customDiagnosticConfig);
connect(m_ui->globalOrCustom, connect(m_ui->globalOrCustom,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@@ -326,6 +332,11 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
connect(m_filesModel.get(), &QAbstractItemModel::dataChanged, [this]() { connect(m_filesModel.get(), &QAbstractItemModel::dataChanged, [this]() {
m_analyzeButton->setEnabled(m_filesModel->hasCheckedFiles()); m_analyzeButton->setEnabled(m_filesModel->hasCheckedFiles());
}); });
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
this, [=]() {
m_ui->diagnosticConfigsSelectionWidget->refresh(diagnosticConfiguration(settings));
});
} }
SelectableFilesDialog::~SelectableFilesDialog() {} SelectableFilesDialog::~SelectableFilesDialog() {}

View File

@@ -395,7 +395,7 @@ void ClangTidyClazyTool::handleStateUpdate()
QTC_ASSERT(m_diagnosticModel, return); QTC_ASSERT(m_diagnosticModel, return);
QTC_ASSERT(m_diagnosticFilterModel, return); QTC_ASSERT(m_diagnosticFilterModel, return);
const int issuesFound = m_diagnosticModel->diagnostics().count(); const int issuesFound = m_diagnosticModel->diagnosticsCount();
const int issuesVisible = m_diagnosticFilterModel->rowCount(); const int issuesVisible = m_diagnosticFilterModel->rowCount();
m_goBack->setEnabled(issuesVisible > 1); m_goBack->setEnabled(issuesVisible > 1);
m_goNext->setEnabled(issuesVisible > 1); m_goNext->setEnabled(issuesVisible > 1);

View File

@@ -80,6 +80,11 @@ QList<Diagnostic> ClangToolsDiagnosticModel::diagnostics() const
return diags; return diags;
} }
int ClangToolsDiagnosticModel::diagnosticsCount() const
{
return rootItem()->childCount();
}
static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) static QString createDiagnosticToolTipString(const Diagnostic &diagnostic)
{ {
typedef QPair<QString, QString> StringPair; typedef QPair<QString, QString> StringPair;
@@ -431,8 +436,9 @@ bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
return true; return true;
// Is the diagnostic suppressed? // Is the diagnostic suppressed?
const Diagnostic diag = static_cast<ClangToolsDiagnosticModel *>(sourceModel()) auto model = static_cast<ClangToolsDiagnosticModel *>(sourceModel());
->diagnostics().at(sourceRow); auto item = static_cast<DiagnosticItem *>(model->rootItem()->childAt(sourceRow));
const Diagnostic &diag = item->diagnostic();
foreach (const SuppressedDiagnostic &d, m_suppressedDiagnostics) { foreach (const SuppressedDiagnostic &d, m_suppressedDiagnostics) {
if (d.description != diag.description) if (d.description != diag.description)
continue; continue;

View File

@@ -59,7 +59,7 @@ public:
DiagnosticItem(const Diagnostic &diag, const OnFixitStatusChanged &onFixitStatusChanged); DiagnosticItem(const Diagnostic &diag, const OnFixitStatusChanged &onFixitStatusChanged);
~DiagnosticItem() override; ~DiagnosticItem() override;
Diagnostic diagnostic() const { return m_diagnostic; } const Diagnostic &diagnostic() const { return m_diagnostic; }
FixitStatus fixItStatus() const { return m_fixitStatus; } FixitStatus fixItStatus() const { return m_fixitStatus; }
void setFixItStatus(const FixitStatus &status); void setFixItStatus(const FixitStatus &status);
@@ -90,6 +90,8 @@ public:
virtual void addDiagnostics(const QList<Diagnostic> &diagnostics); virtual void addDiagnostics(const QList<Diagnostic> &diagnostics);
virtual QList<Diagnostic> diagnostics() const; virtual QList<Diagnostic> diagnostics() const;
int diagnosticsCount() const;
enum ItemRole { enum ItemRole {
DiagnosticRole = Debugger::DetailedErrorView::FullTextRole + 1 DiagnosticRole = Debugger::DetailedErrorView::FullTextRole + 1
}; };

View File

@@ -293,6 +293,11 @@ static void paintIconAndText(QPainter *painter, const QRect &rect,
const QIcon &icon, const QString &text, const QIcon &icon, const QString &text,
bool enabled, bool selected) bool enabled, bool selected)
{ {
QFont boldFont(painter->font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
const bool drawIcon = rect.height() > 36; const bool drawIcon = rect.height() > 36;
if (drawIcon) { if (drawIcon) {
const int textHeight = const int textHeight =
@@ -322,10 +327,6 @@ static void paintIconAndText(QPainter *painter, const QRect &rect,
painter->translate(0, -1); painter->translate(0, -1);
QRect tabTextRect(rect); QRect tabTextRect(rect);
tabTextRect.translate(0, drawIcon ? -2 : 1); tabTextRect.translate(0, drawIcon ? -2 : 1);
QFont boldFont(painter->font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter)
| Qt::TextWordWrap; | Qt::TextWordWrap;
painter->drawText(tabTextRect, textFlags, text); painter->drawText(tabTextRect, textFlags, text);

View File

@@ -32,6 +32,8 @@
#include <QSharedPointer> #include <QSharedPointer>
#include <utility>
namespace CPlusPlus { class Document; } namespace CPlusPlus { class Document; }
namespace Utils { namespace Utils {
@@ -91,6 +93,9 @@ public:
virtual Utils::Link linkFromIndex(const QModelIndex &) const = 0; virtual Utils::Link linkFromIndex(const QModelIndex &) const = 0;
virtual Utils::LineColumn lineColumnFromIndex(const QModelIndex &) const = 0; virtual Utils::LineColumn lineColumnFromIndex(const QModelIndex &) const = 0;
using Range = std::pair<Utils::LineColumn, Utils::LineColumn>;
virtual Range rangeFromIndex(const QModelIndex &) const = 0;
signals: signals:
void needsUpdate(); void needsUpdate();
}; };

View File

@@ -170,7 +170,10 @@ QStringList ClangDiagnosticConfigsModel::globalDiagnosticOptions()
return { return {
// Avoid undesired warnings from e.g. Q_OBJECT // Avoid undesired warnings from e.g. Q_OBJECT
QStringLiteral("-Wno-unknown-pragmas"), QStringLiteral("-Wno-unknown-pragmas"),
QStringLiteral("-Wno-unknown-warning-option") QStringLiteral("-Wno-unknown-warning-option"),
// qdoc commands
QStringLiteral("-Wno-documentation-unknown-command")
}; };
} }

Some files were not shown because too many files have changed in this diff Show More