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/
**
** 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
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.
\endlist
@@ -83,7 +86,7 @@
is.
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:
\image qtcreator-kits.png

View File

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

View File

@@ -1268,6 +1268,7 @@
\li \c :substitute substitutes an expression in a range
\li \c :'<,'>!cmd filters through an external command (for example,
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 :read
\li \c :yank, \c :delete, \c :change

View File

@@ -403,6 +403,10 @@
\li \uicontrol {Build System} - Errors and warnings encountered during a
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
\uicontrol {Compile Output} pane for more detailed information.
@@ -422,6 +426,8 @@
by \l{Showing Task List Files in Issues Pane}
{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 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/
**
** This file is part of the Qt Creator documentation.
@@ -39,72 +39,6 @@
\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?}
@@ -143,6 +77,89 @@
\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
\b {The Qt API Reference Documentation is missing and context help does

View File

@@ -67,6 +67,10 @@
\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
\l{Specifying Build Settings}.

View File

@@ -74,7 +74,15 @@
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.
@@ -101,6 +109,11 @@
the \uicontrol {Edit Environment Changes} dialog. For more information
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
on the target platform. \QC automatically detects available
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>
@@ -34,4 +34,4 @@ QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
return debug.nospace() << "AliveMessage()";
}
}
} // namespace ClangBackEnd

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "documentannotationschangedmessage.h"
#include "annotationsmessage.h"
#include <QDebug>
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.diagnostics.size()
<< ", " << !message.firstHeaderErrorDiagnostic.text.isEmpty()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,19 +41,23 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0;
virtual void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) = 0;
virtual void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) = 0;
virtual void unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) = 0;
virtual void registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) = 0;
virtual void unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) = 0;
virtual void registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) = 0;
virtual void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) = 0;
virtual void completeCode(const CompleteCodeMessage &message) = 0;
virtual void requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) = 0;
virtual void documentsOpened(const DocumentsOpenedMessage &message) = 0;
virtual void documentsChanged(const DocumentsChangedMessage &message) = 0;
virtual void documentsClosed(const DocumentsClosedMessage &message) = 0;
virtual void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) = 0;
virtual void projectPartsUpdated(const ProjectPartsUpdatedMessage &message) = 0;
virtual void projectPartsRemoved(const ProjectPartsRemovedMessage &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 requestFollowSymbol(const RequestFollowSymbolMessage &message) = 0;
virtual void requestToolTip(const RequestToolTipMessage &message) = 0;
virtual void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) = 0;
};
} // namespace ClangBackEnd

View File

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

View File

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

View File

@@ -49,19 +49,23 @@ public:
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
void end() override;
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;
void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) override;
void unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) override;
void registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) override;
void unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) override;
void registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) override;
void unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) override;
void completeCode(const CompleteCodeMessage &message) override;
void requestDocumentAnnotations(const RequestDocumentAnnotationsMessage &message) override;
void documentsOpened(const DocumentsOpenedMessage &message) override;
void documentsChanged(const DocumentsChangedMessage &message) override;
void documentsClosed(const DocumentsClosedMessage &message) override;
void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) override;
void projectPartsUpdated(const ProjectPartsUpdatedMessage &message) override;
void projectPartsRemoved(const ProjectPartsRemovedMessage &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 requestFollowSymbol(const RequestFollowSymbolMessage &message) override;
void requestToolTip(const RequestToolTipMessage &message) override;
void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) override;
};
} // namespace ClangBackEnd

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "cmbcodecompletedmessage.h"
#include "completionsmessage.h"
#include <QDebug>
@@ -40,9 +40,9 @@ static const char *completionCorrectionToText(CompletionCorrection correction)
}
#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 << ", "
<< completionCorrectionToText(message.neededCorrection) << ", "

View File

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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "registerunsavedfilesforeditormessage.h"
#include "documentschangedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileContainer<< ", ";

View File

@@ -31,30 +31,31 @@
namespace ClangBackEnd {
class RegisterUnsavedFilesForEditorMessage
class DocumentsChangedMessage
{
public:
RegisterUnsavedFilesForEditorMessage() = default;
RegisterUnsavedFilesForEditorMessage(const QVector<FileContainer> &fileContainers)
DocumentsChangedMessage() = default;
DocumentsChangedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers)
{
}
friend QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const DocumentsChangedMessage &message)
{
out << message.fileContainers;
return out;
}
friend QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, DocumentsChangedMessage &message)
{
in >> message.fileContainers;
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;
}
@@ -63,7 +64,7 @@ public:
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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "cmbunregistertranslationunitsforeditormessage.h"
#include "documentsclosedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileContainer << ", ";

View File

@@ -25,36 +25,38 @@
#pragma once
#include "clangsupport_global.h"
#include "filecontainer.h"
#include <QVector>
namespace ClangBackEnd {
class UpdateTranslationUnitsForEditorMessage
class DocumentsClosedMessage
{
public:
UpdateTranslationUnitsForEditorMessage() = default;
UpdateTranslationUnitsForEditorMessage(const QVector<FileContainer> &fileContainers)
DocumentsClosedMessage() = default;
DocumentsClosedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers)
{
}
friend QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const DocumentsClosedMessage &message)
{
out << message.fileContainers;
return out;
}
friend QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, DocumentsClosedMessage &message)
{
in >> message.fileContainers;
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;
}
@@ -63,7 +65,7 @@ public:
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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "cmbregistertranslationunitsforeditormessage.h"
#include "documentsopenedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileContainer<< ", ";

View File

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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "updatevisibletranslationunitsmessage.h"
#include "documentvisibilitychangedmessage.h"
#include <QDebug>
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 << ", ";

View File

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

View File

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

View File

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

View File

@@ -29,12 +29,23 @@
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)
{
debug.nospace() << "FollowSymbolMessage("
<< message.fileContainer
<< ", " << message.ticketNumber
<< ", " << message.sourceRange;
<< ", " << message.result;
debug.nospace() << ")";

View File

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

View File

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

View File

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

View File

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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "cmbunregisterprojectsforeditormessage.h"
#include "projectpartsremovedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileNames_ << ", ";

View File

@@ -33,30 +33,31 @@
namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT UnregisterProjectPartsForEditorMessage
class CLANGSUPPORT_EXPORT ProjectPartsRemovedMessage
{
public:
UnregisterProjectPartsForEditorMessage() = default;
UnregisterProjectPartsForEditorMessage(const Utf8StringVector &projectPartIds)
ProjectPartsRemovedMessage() = default;
ProjectPartsRemovedMessage(const Utf8StringVector &projectPartIds)
: projectPartIds(projectPartIds)
{
}
friend QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const ProjectPartsRemovedMessage &message)
{
out << message.projectPartIds;
return out;
}
friend QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, ProjectPartsRemovedMessage &message)
{
in >> message.projectPartIds;
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;
}
@@ -65,7 +66,7 @@ public:
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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "cmbregisterprojectsforeditormessage.h"
#include "projectpartsupdatedmessage.h"
#include <QDebug>
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)
debug.nospace() << projectContainer<< ", ";

View File

@@ -32,30 +32,31 @@
namespace ClangBackEnd {
class RegisterProjectPartsForEditorMessage
class ProjectPartsUpdatedMessage
{
public:
RegisterProjectPartsForEditorMessage() = default;
RegisterProjectPartsForEditorMessage(const QVector<ProjectPartContainer> &projectContainers)
ProjectPartsUpdatedMessage() = default;
ProjectPartsUpdatedMessage(const QVector<ProjectPartContainer> &projectContainers)
: projectContainers(projectContainers)
{
}
friend QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const ProjectPartsUpdatedMessage &message)
{
out << message.projectContainers;
return out;
}
friend QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, ProjectPartsUpdatedMessage &message)
{
in >> message.projectContainers;
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;
}
@@ -64,7 +65,7 @@ public:
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

View File

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

View File

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

View File

@@ -29,30 +29,31 @@
namespace ClangBackEnd {
class RequestDocumentAnnotationsMessage
class RequestAnnotationsMessage
{
public:
RequestDocumentAnnotationsMessage() = default;
RequestDocumentAnnotationsMessage(const FileContainer &fileContainer)
RequestAnnotationsMessage() = default;
RequestAnnotationsMessage(const FileContainer &fileContainer)
: fileContainer(fileContainer)
{
}
friend QDataStream &operator<<(QDataStream &out, const RequestDocumentAnnotationsMessage &message)
friend QDataStream &operator<<(QDataStream &out, const RequestAnnotationsMessage &message)
{
out << message.fileContainer;
return out;
}
friend QDataStream &operator>>(QDataStream &in, RequestDocumentAnnotationsMessage &message)
friend QDataStream &operator>>(QDataStream &in, RequestAnnotationsMessage &message)
{
in >> message.fileContainer;
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;
}
@@ -61,7 +62,7 @@ public:
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

View File

@@ -23,17 +23,17 @@
**
****************************************************************************/
#include "cmbcompletecodemessage.h"
#include "requestcompletionsmessage.h"
#include <QDebug>
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.line << ", ";

View File

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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "updatetranslationunitsforeditormessage.h"
#include "unsavedfilesremovedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileContainer<< ", ";

View File

@@ -31,30 +31,31 @@
namespace ClangBackEnd {
class UnregisterUnsavedFilesForEditorMessage
class UnsavedFilesRemovedMessage
{
public:
UnregisterUnsavedFilesForEditorMessage() = default;
UnregisterUnsavedFilesForEditorMessage(const QVector<FileContainer> &fileContainers)
UnsavedFilesRemovedMessage() = default;
UnsavedFilesRemovedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers)
{
}
friend QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesRemovedMessage &message)
{
out << message.fileContainers;
return out;
}
friend QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, UnsavedFilesRemovedMessage &message)
{
in >> message.fileContainers;
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;
}
@@ -63,7 +64,7 @@ public:
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

View File

@@ -23,15 +23,15 @@
**
****************************************************************************/
#include "unregisterunsavedfilesforeditormessage.h"
#include "unsavedfilesupdatedmessage.h"
#include <QDebug>
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)
debug.nospace() << fileContainer<< ", ";

View File

@@ -25,38 +25,37 @@
#pragma once
#include "clangsupport_global.h"
#include "filecontainer.h"
#include <QVector>
namespace ClangBackEnd {
class UnregisterTranslationUnitsForEditorMessage
class UnsavedFilesUpdatedMessage
{
public:
UnregisterTranslationUnitsForEditorMessage() = default;
UnregisterTranslationUnitsForEditorMessage(const QVector<FileContainer> &fileContainers)
UnsavedFilesUpdatedMessage() = default;
UnsavedFilesUpdatedMessage(const QVector<FileContainer> &fileContainers)
: fileContainers(fileContainers)
{
}
friend QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message)
friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesUpdatedMessage &message)
{
out << message.fileContainers;
return out;
}
friend QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message)
friend QDataStream &operator>>(QDataStream &in, UnsavedFilesUpdatedMessage &message)
{
in >> message.fileContainers;
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;
}
@@ -65,7 +64,7 @@ public:
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

View File

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

View File

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

View File

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

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
import QtQuick 2.1
import QtQuick 2.9
import TimelineTheme 1.0
Item {
@@ -153,7 +153,9 @@ Item {
spacing: innerMargin
columns: 2
property int minimumWidth: {
property int minimumWidth: minimumInnerWidth
onPositioningComplete: {
// max(width of longest label * 2, minimumInnerWidth)
var result = minimumInnerWidth;
for (var i = 0; i < children.length; ++i) {
@@ -161,10 +163,10 @@ Item {
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
onMinimumWidthChanged: {

View File

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

View File

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

View File

@@ -357,7 +357,6 @@ void TimelineTraceManager::clearEventStorage()
d->reset();
if (d->notesModel)
d->notesModel->clear();
setVisibleFeatures(0);
setRecordedFeatures(0);
d->eventStorage->clear();
}
@@ -385,7 +384,6 @@ void TimelineTraceManager::restrictByFilter(TraceEventFilter filter)
d->notesModel->stash();
d->reset();
setVisibleFeatures(0);
QFutureInterface<void> future;
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;
}
friend bool operator!=(LineColumn first, LineColumn second)
{
return !(first == second);
}
public:
int line = -1;
int column = -1;

View File

@@ -26,6 +26,7 @@
#pragma once
#include "functiontraits.h"
#include "optional.h"
#include "utils_global.h"
#include <QCoreApplication>
@@ -57,6 +58,9 @@ struct hasCallOperator
};
namespace Utils {
using StackSizeInBytes = Utils::optional<uint>;
namespace Internal {
/*
@@ -388,6 +392,34 @@ private:
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
/*!
@@ -418,20 +450,11 @@ template <typename Function, typename... Args,
QFuture<ResultType>
runAsync(QThreadPool *pool, QThread::Priority priority, Function &&function, Args&&... args)
{
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);
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;
return Internal::runAsync_internal(pool,
StackSizeInBytes(),
priority,
std::forward<Function>(function),
std::forward<Args>(args)...);
}
/*!
@@ -448,6 +471,47 @@ runAsync(QThread::Priority priority, Function &&function, 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.
\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->setLabelText(tr("Activity manager start options:"));
amStartArgsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
amStartArgsAspect->setHistoryCompleter("Android.AmStartArgs.History");
addExtraAspect(amStartArgsAspect);
auto preStartShellCmdAspect = new BaseStringListAspect(this);

View File

@@ -422,7 +422,7 @@ void AndroidRunnerWorker::asyncStartHelper()
runAdb(removeForward);
if (!runAdb({"forward", port, port})) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.")
.arg(m_lastRunAdbError));
.arg(m_lastRunAdbError) + "\n" + m_lastRunAdbRawOutput);
return;
}
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
// are going to get installed or not we have to soften the condition...
const QString currentExecutable = ensureExeEnding(runnable.executable);
const QString currentBST = runConfig->buildKey() + '|';
const QString currentBST = runConfig->buildKey();
qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
qCDebug(LOG) << " BST of RunConfig" << currentBST;
const bool isQbs = runConfig->id().toString().startsWith("Qbs.RunConfiguration:"); // BAD!
if ((localExecutable == currentExecutable)
|| (deployedExecutable == currentExecutable)
|| (isQbs && Utils::anyOf(buildSystemTargets, [currentBST] (const QString &b) {
return b.startsWith(currentBST);
}))) {
|| (buildSystemTargets.contains(currentBST))) {
qCDebug(LOG) << " Using this RunConfig.";
m_origRunConfig = runConfig;
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
m_displayName = (*buildSystemTargets.begin()).split('|').first();
m_displayName = (*buildSystemTargets.begin());
}
/**

View File

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

View File

@@ -63,14 +63,40 @@ public:
BackendCommunicator();
~BackendCommunicator();
void registerTranslationUnitsForEditor(const FileContainers &fileContainers);
void updateTranslationUnitsForEditor(const FileContainers &fileContainers);
void unregisterTranslationUnitsForEditor(const FileContainers &fileContainers);
void registerProjectPartsForEditor(const ProjectPartContainers &projectPartContainers);
void unregisterProjectPartsForEditor(const QStringList &projectPartIds);
void registerUnsavedFilesForEditor(const FileContainers &fileContainers);
void unregisterUnsavedFilesForEditor(const FileContainers &fileContainers);
void requestDocumentAnnotations(const ClangBackEnd::FileContainer &fileContainer);
void documentsOpened(const FileContainers &fileContainers);
void documentsChanged(Core::IDocument *document);
void documentsChanged(const QString &filePath,
const QByteArray &contents,
uint documentRevision);
void documentsChanged(const FileContainers &fileContainers);
void documentsChangedFromCppEditorDocument(const QString &filePath);
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(
const FileContainer &fileContainer,
quint32 line,
@@ -86,39 +112,17 @@ public:
QFuture<CppTools::SymbolInfo> requestFollowSymbol(const FileContainer &curFileContainer,
quint32 line,
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 registerFallbackProjectPart();
void updateTranslationUnitVisiblity();
bool isNotWaitingForCompletion() const;
private:
void initializeBackend();
void initializeBackendWithCurrentData();
void registerCurrentProjectParts();
void projectPartsUpdatedForCurrentProjects();
void restoreCppEditorDocuments();
void resetCppEditorDocumentProcessors();
void registerVisibleCppEditorDocumentAndMarkInvisibleDirty();
void registerCurrentCodeModelUiHeaders();
void unsavedFilesUpdatedForUiHeaders();
void setupDummySender();
@@ -131,8 +135,8 @@ private:
void logStartTimeOut();
void logError(const QString &text);
void updateTranslationUnitVisiblity(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorsFilePaths);
void documentVisibilityChanged(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorsFilePaths);
private:
BackendReceiver m_receiver;

View File

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

View File

@@ -51,7 +51,7 @@ public:
using AliveHandler = std::function<void ()>;
void setAliveHandler(const AliveHandler &handler);
void addExpectedCodeCompletedMessage(quint64 ticket, ClangCompletionAssistProcessor *processor);
void addExpectedCompletionsMessage(quint64 ticket, ClangCompletionAssistProcessor *processor);
void deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget);
QFuture<CppTools::CursorInfo>
@@ -60,16 +60,16 @@ public:
= CppTools::SemanticInfo::LocalUseMap());
QFuture<CppTools::SymbolInfo> addExpectedRequestFollowSymbolMessage(quint64 ticket);
QFuture<CppTools::ToolTipInfo> addExpectedToolTipMessage(quint64 ticket);
bool isExpectingCodeCompletedMessage() const;
bool isExpectingCompletionsMessage() const;
void reset();
private:
void alive() 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 tooltip(const ClangBackEnd::ToolTipMessage &message) override;
void followSymbol(const ClangBackEnd::FollowSymbolMessage &message) override;

View File

@@ -50,67 +50,67 @@ void BackendSender::end()
m_connection->sendEndMessage();
}
void BackendSender::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
void BackendSender::documentsOpened(const DocumentsOpenedMessage &message)
{
QTC_CHECK(m_connection->isConnected());
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());
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());
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());
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());
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());
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());
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());
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());
qCDebugIpc() << message;
m_connection->serverProxy().requestDocumentAnnotations(message);
m_connection->serverProxy().requestAnnotations(message);
}
void BackendSender::requestReferences(const RequestReferencesMessage &message)
@@ -134,11 +134,11 @@ void BackendSender::requestFollowSymbol(const RequestFollowSymbolMessage &messag
m_connection->serverProxy().requestFollowSymbol(message);
}
void BackendSender::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
void BackendSender::documentVisibilityChanged(const DocumentVisibilityChangedMessage &message)
{
QTC_CHECK(m_connection->isConnected());
qCDebugIpc() << message;
m_connection->serverProxy().updateVisibleTranslationUnits(message);
m_connection->serverProxy().documentVisibilityChanged(message);
}
} // namespace Internal

View File

@@ -38,19 +38,23 @@ public:
BackendSender(ClangBackEnd::ClangCodeModelConnectionClient *connectionClient);
void end() override;
void registerTranslationUnitsForEditor(const ClangBackEnd::RegisterTranslationUnitForEditorMessage &message) override;
void updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message) override;
void unregisterTranslationUnitsForEditor(const ClangBackEnd::UnregisterTranslationUnitsForEditorMessage &message) override;
void registerProjectPartsForEditor(const ClangBackEnd::RegisterProjectPartsForEditorMessage &message) override;
void unregisterProjectPartsForEditor(const ClangBackEnd::UnregisterProjectPartsForEditorMessage &message) override;
void registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message) override;
void unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message) override;
void completeCode(const ClangBackEnd::CompleteCodeMessage &message) override;
void requestDocumentAnnotations(const ClangBackEnd::RequestDocumentAnnotationsMessage &message) override;
void documentsOpened(const ClangBackEnd::DocumentsOpenedMessage &message) override;
void documentsChanged(const ClangBackEnd::DocumentsChangedMessage &message) override;
void documentsClosed(const ClangBackEnd::DocumentsClosedMessage &message) override;
void documentVisibilityChanged(const ClangBackEnd::DocumentVisibilityChangedMessage &message) override;
void projectPartsUpdated(const ClangBackEnd::ProjectPartsUpdatedMessage &message) override;
void projectPartsRemoved(const ClangBackEnd::ProjectPartsRemovedMessage &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 requestToolTip(const ClangBackEnd::RequestToolTipMessage &message) override;
void requestFollowSymbol(const ClangBackEnd::RequestFollowSymbolMessage &message) override;
void updateVisibleTranslationUnits(const ClangBackEnd::UpdateVisibleTranslationUnitsMessage &message) override;
private:
ClangBackEnd::ClangCodeModelConnectionClient *m_connection = nullptr;

View File

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

View File

@@ -28,6 +28,8 @@
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cpptoolsconstants.h>
#include <utils/qtcassert.h>
#include <utils/tooltip/tooltip.h>
@@ -46,14 +48,8 @@ namespace {
// CLANG-UPGRADE-CHECK: Checks/update URLs.
//
// For tidy, upgrade the version in the URL. Note that we cannot use the macro
// 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,
// Once it gets dedicated documentation pages for released versions,
// 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[]
= "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md";
@@ -283,7 +279,7 @@ private:
return QString();
// 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)

View File

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

View File

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

View File

@@ -140,6 +140,19 @@ static Utils::Link linkAtCursor(const QTextCursor &cursor,
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,
::Utils::ProcessLinkCallback &&processLinkCallback,
bool resolveTarget,
@@ -185,11 +198,11 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
return callback(Utils::Link());
CppTools::SymbolInfo result = m_watcher->result();
// We did not fail but the result is empty
if (result.fileName.isEmpty()) {
if (result.fileName.isEmpty() || result.isPureDeclarationForUsage) {
const CppTools::RefactoringEngineInterface &refactoringEngine
= *CppTools::CppModelManager::instance();
refactoringEngine.globalFollowSymbol(data,
std::move(callback),
extendedCallback(std::move(callback), result),
snapshot,
documentFromSemanticInfo,
symbolFinder,

View File

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

View File

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

View File

@@ -80,6 +80,17 @@ void buildTree(const TokenContainers &containers,
if (lexicalParentIndex >= 0 && 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());
}
@@ -213,10 +224,20 @@ bool OverviewModel::isGenerated(const QModelIndex &) const
TokenTreeItem *item = static_cast<TokenTreeItem *>(itemForIndex(sourceIndex));
if (!item)
return {};
::Utils::LineColumn lineColumn;
lineColumn.line = static_cast<int>(item->token.line);
lineColumn.column = static_cast<int>(item->token.column);
return lineColumn;
return ::Utils::LineColumn(static_cast<int>(item->token.line),
static_cast<int>(item->token.column));
}
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

View File

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

View File

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

View File

@@ -395,7 +395,7 @@ void ClangTidyClazyTool::handleStateUpdate()
QTC_ASSERT(m_diagnosticModel, 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();
m_goBack->setEnabled(issuesVisible > 1);
m_goNext->setEnabled(issuesVisible > 1);

View File

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

View File

@@ -59,7 +59,7 @@ public:
DiagnosticItem(const Diagnostic &diag, const OnFixitStatusChanged &onFixitStatusChanged);
~DiagnosticItem() override;
Diagnostic diagnostic() const { return m_diagnostic; }
const Diagnostic &diagnostic() const { return m_diagnostic; }
FixitStatus fixItStatus() const { return m_fixitStatus; }
void setFixItStatus(const FixitStatus &status);
@@ -90,6 +90,8 @@ public:
virtual void addDiagnostics(const QList<Diagnostic> &diagnostics);
virtual QList<Diagnostic> diagnostics() const;
int diagnosticsCount() const;
enum ItemRole {
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,
bool enabled, bool selected)
{
QFont boldFont(painter->font());
boldFont.setPointSizeF(StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
const bool drawIcon = rect.height() > 36;
if (drawIcon) {
const int textHeight =
@@ -322,10 +327,6 @@ static void paintIconAndText(QPainter *painter, const QRect &rect,
painter->translate(0, -1);
QRect tabTextRect(rect);
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)
| Qt::TextWordWrap;
painter->drawText(tabTextRect, textFlags, text);

View File

@@ -32,6 +32,8 @@
#include <QSharedPointer>
#include <utility>
namespace CPlusPlus { class Document; }
namespace Utils {
@@ -91,6 +93,9 @@ public:
virtual Utils::Link linkFromIndex(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:
void needsUpdate();
};

View File

@@ -170,7 +170,10 @@ QStringList ClangDiagnosticConfigsModel::globalDiagnosticOptions()
return {
// Avoid undesired warnings from e.g. Q_OBJECT
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