forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.14'
Change-Id: I516e87eed1b716ec085095c9dd4f47f04a99de7c
This commit is contained in:
BIN
doc/qtcreator/images/qtcreator-build-steps-conan-install.png
Normal file
BIN
doc/qtcreator/images/qtcreator-build-steps-conan-install.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 27 KiB |
@@ -0,0 +1,44 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Creator documentation.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Free Documentation License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Free
|
||||||
|
** Documentation License version 1.3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file included in the packaging of
|
||||||
|
** this file. Please review the following information to ensure
|
||||||
|
** the GNU Free Documentation License version 1.3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
//! [conan build steps]
|
||||||
|
\section1 Specifying Build Settings for Conan
|
||||||
|
|
||||||
|
To configure a project to be built using the Conan package manager, select
|
||||||
|
\uicontrol {Add Build Step} > \uicontrol {Run Conan Install}.
|
||||||
|
|
||||||
|
\image qtcreator-build-steps-conan-install.png "Conan Install build step"
|
||||||
|
|
||||||
|
In the \uicontrol {Conan file} field, enter the location of the
|
||||||
|
\e conanfile.txt file for the project.
|
||||||
|
|
||||||
|
The \uicontrol {Conan install} field displays the effective
|
||||||
|
build command. You can add arguments for the command in the
|
||||||
|
\uicontrol {Additional arguments} field.
|
||||||
|
|
||||||
|
For more information about configuring Conan, see \l{Setting Up Conan}.
|
||||||
|
//! [conan build steps]
|
||||||
|
*/
|
66
doc/qtcreator/src/conan/creator-projects-conan.qdoc
Normal file
66
doc/qtcreator/src/conan/creator-projects-conan.qdoc
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Creator documentation.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Free Documentation License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Free
|
||||||
|
** Documentation License version 1.3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file included in the packaging of
|
||||||
|
** this file. Please review the following information to ensure
|
||||||
|
** the GNU Free Documentation License version 1.3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\page creator-project-conan.html
|
||||||
|
\previouspage creator-project-incredibuild.html
|
||||||
|
\nextpage creator-cli.html
|
||||||
|
|
||||||
|
\title Setting Up Conan
|
||||||
|
|
||||||
|
\l {https://conan.io}{Conan} is a C/C++ package manager that speeds up the
|
||||||
|
integration of C or C++ libraries into your own project. It's available on
|
||||||
|
all the \l{Supported Platforms}{supported development platforms}.
|
||||||
|
|
||||||
|
Conan can be integrated into most build systems that are integrated into
|
||||||
|
\QC:
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li \l{https://docs.conan.io/en/latest/integrations/cmake.html}{CMake}
|
||||||
|
\li \l{https://docs.conan.io/en/latest/integrations/qbs.html}{Qbs}
|
||||||
|
\li \l{https://docs.conan.io/en/latest/integrations/qmake.html}{qmake}
|
||||||
|
\li \l{https://docs.conan.io/en/latest/integrations/meson.html}{Meson}
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The client-server architecture of Conan enables the client to fetch packages
|
||||||
|
from and upload them to remote servers that act as package storage. The
|
||||||
|
client creates the packages, and if necessary, handles building them from
|
||||||
|
sources. Because the client has a local cache for package storage, you can
|
||||||
|
work offline, as long as no new packages are needed from remote servers.
|
||||||
|
|
||||||
|
To use Conan, install it by using the Qt installer.
|
||||||
|
|
||||||
|
To enable the experimental Conan plugin, select \uicontrol Help >
|
||||||
|
\uicontrol {About Plugins} > \uicontrol Utilities > \uicontrol Conan.
|
||||||
|
Then select \uicontrol {Restart Now} to restart \QC and load the plugin.
|
||||||
|
|
||||||
|
For each project, you must write a
|
||||||
|
\l{https://docs.conan.io/en/latest/reference/conanfile.html}{conanfile.py}
|
||||||
|
or \l{https://docs.conan.io/en/latest/reference/conanfile_txt.html}
|
||||||
|
{conanfile.txt} file that specifies the needed libraries and packages.
|
||||||
|
Then, you must edit the build settings of the project to specify the
|
||||||
|
location of the file and the contents of the Conan install command.
|
||||||
|
For more information, see \l {Specifying Build Settings for Conan}.
|
||||||
|
*/
|
@@ -30,7 +30,7 @@
|
|||||||
// **********************************************************************
|
// **********************************************************************
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\previouspage creator-project-incredibuild.html
|
\previouspage creator-project-conan.html
|
||||||
\page creator-cli.html
|
\page creator-cli.html
|
||||||
\nextpage creator-keyboard-shortcuts.html
|
\nextpage creator-keyboard-shortcuts.html
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\previouspage creator-project-meson.html
|
\previouspage creator-project-meson.html
|
||||||
\page creator-project-incredibuild.html
|
\page creator-project-incredibuild.html
|
||||||
\nextpage creator-cli.html
|
\nextpage creator-project-conan.html
|
||||||
|
|
||||||
\title Setting Up IncrediBuild
|
\title Setting Up IncrediBuild
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2020 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -82,6 +82,13 @@
|
|||||||
|
|
||||||
IncrediBuild decreases the time it takes to build C++ code.
|
IncrediBuild decreases the time it takes to build C++ code.
|
||||||
|
|
||||||
|
\li \l{Setting Up Conan}
|
||||||
|
|
||||||
|
The experimental Conan plugin integrates the Conan package manager
|
||||||
|
that speeds up the integration of C or C++ libraries into your
|
||||||
|
project. You can use Conan with most build systems integrated into
|
||||||
|
\QC.
|
||||||
|
|
||||||
\endlist
|
\endlist
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@@ -182,6 +182,7 @@
|
|||||||
\include creator-projects-settings-build-qbs.qdocinc qbs build steps
|
\include creator-projects-settings-build-qbs.qdocinc qbs build steps
|
||||||
\include creator-projects-meson-building.qdocinc meson build steps
|
\include creator-projects-meson-building.qdocinc meson build steps
|
||||||
\include creator-projects-incredibuild-building.qdocinc incredibuild build steps
|
\include creator-projects-incredibuild-building.qdocinc incredibuild build steps
|
||||||
|
\include creator-projects-conan-building.qdocinc conan build steps
|
||||||
|
|
||||||
\section2 Adding Custom Build Steps
|
\section2 Adding Custom Build Steps
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
** Copyright (C) 2021 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the Qt Creator documentation.
|
** This file is part of the Qt Creator documentation.
|
||||||
@@ -64,9 +64,17 @@
|
|||||||
To view the warning and error messages, move the mouse pointer over
|
To view the warning and error messages, move the mouse pointer over
|
||||||
the kit name.
|
the kit name.
|
||||||
|
|
||||||
To modify kit configuration or to add kits to the list, select
|
In the list of kits, you may see entries described as \e {Replacement for
|
||||||
\uicontrol {Manage Kits}. For more information about managing kits, see
|
<kit-name>}. \QC generates them to save your project-specific settings,
|
||||||
\l{Adding Kits}.
|
such as custom build flags or run configuration arguments that would
|
||||||
|
disappear if the corresponding kits were simply removed when you remove
|
||||||
|
Qt versions while updating your Qt installation. You can modify the kit
|
||||||
|
configuration to use a currently installed Qt version and save the kit
|
||||||
|
under a new name.
|
||||||
|
|
||||||
|
To modify kit configuration or to add kits to the list or to remove
|
||||||
|
them from it, select \uicontrol {Manage Kits}. For more information
|
||||||
|
about managing kits, see \l{Adding Kits}.
|
||||||
|
|
||||||
Each kit consists of a set of values that define one environment, such as a
|
Each kit consists of a set of values that define one environment, such as a
|
||||||
\l{glossary-device}{device}, compiler, and Qt version. For more information,
|
\l{glossary-device}{device}, compiler, and Qt version. For more information,
|
||||||
|
@@ -277,6 +277,7 @@
|
|||||||
\li \l{Setting Up Nimble}
|
\li \l{Setting Up Nimble}
|
||||||
\li \l{Setting Up Meson}
|
\li \l{Setting Up Meson}
|
||||||
\li \l{Setting Up IncrediBuild}
|
\li \l{Setting Up IncrediBuild}
|
||||||
|
\li \l{Setting Up Conan}
|
||||||
\endlist
|
\endlist
|
||||||
\li \l{Using Command Line Options}
|
\li \l{Using Command Line Options}
|
||||||
\li \l{Keyboard Shortcuts}
|
\li \l{Keyboard Shortcuts}
|
||||||
|
@@ -293,7 +293,7 @@
|
|||||||
|
|
||||||
\image qtquickcontrols2-button-flat.gif "Flat button"
|
\image qtquickcontrols2-button-flat.gif "Flat button"
|
||||||
|
|
||||||
\if definded(qtdesignstudio)
|
\if defined(qtdesignstudio)
|
||||||
To create a button that contains an icon, use the wizard template to
|
To create a button that contains an icon, use the wizard template to
|
||||||
\l{Creating Custom Controls}{create a custom button} and drag-and-drop
|
\l{Creating Custom Controls}{create a custom button} and drag-and-drop
|
||||||
the icon to the button background item. For an example of using the
|
the icon to the button background item. For an example of using the
|
||||||
|
@@ -34,9 +34,11 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
#include <languageserverprotocol/completion.h>
|
||||||
#include <languageserverprotocol/diagnostics.h>
|
#include <languageserverprotocol/diagnostics.h>
|
||||||
#include <languageserverprotocol/languagefeatures.h>
|
#include <languageserverprotocol/languagefeatures.h>
|
||||||
#include <languageserverprotocol/messages.h>
|
#include <languageserverprotocol/messages.h>
|
||||||
|
#include <languageserverprotocol/servercapabilities.h>
|
||||||
#include <languageserverprotocol/workspace.h>
|
#include <languageserverprotocol/workspace.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
@@ -353,16 +355,41 @@ void Client::closeDocument(TextEditor::TextDocument *document)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::updateCompletionProvider(TextEditor::TextDocument *document)
|
||||||
|
{
|
||||||
|
bool useLanguageServer = m_serverCapabilities.completionProvider().has_value();
|
||||||
|
auto clientCompletionProvider = static_cast<LanguageClientCompletionAssistProvider *>(
|
||||||
|
m_clientProviders.completionAssistProvider.data());
|
||||||
|
if (m_dynamicCapabilities.isRegistered(CompletionRequest::methodName).value_or(false)) {
|
||||||
|
const QJsonValue &options = m_dynamicCapabilities.option(CompletionRequest::methodName);
|
||||||
|
const TextDocumentRegistrationOptions docOptions(options);
|
||||||
|
useLanguageServer = docOptions.filterApplies(document->filePath(),
|
||||||
|
Utils::mimeTypeForName(document->mimeType()));
|
||||||
|
|
||||||
|
const ServerCapabilities::CompletionOptions completionOptions(options);
|
||||||
|
if (completionOptions.isValid(nullptr))
|
||||||
|
clientCompletionProvider->setTriggerCharacters(completionOptions.triggerCharacters());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document->completionAssistProvider() != clientCompletionProvider) {
|
||||||
|
if (useLanguageServer) {
|
||||||
|
m_resetAssistProvider[document].completionAssistProvider
|
||||||
|
= document->completionAssistProvider();
|
||||||
|
document->setCompletionAssistProvider(clientCompletionProvider);
|
||||||
|
}
|
||||||
|
} else if (!useLanguageServer) {
|
||||||
|
document->setCompletionAssistProvider(
|
||||||
|
m_resetAssistProvider[document].completionAssistProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::activateDocument(TextEditor::TextDocument *document)
|
void Client::activateDocument(TextEditor::TextDocument *document)
|
||||||
{
|
{
|
||||||
auto uri = DocumentUri::fromFilePath(document->filePath());
|
auto uri = DocumentUri::fromFilePath(document->filePath());
|
||||||
m_diagnosticManager.showDiagnostics(uri);
|
m_diagnosticManager.showDiagnostics(uri);
|
||||||
SemanticHighligtingSupport::applyHighlight(document, m_highlights.value(uri), capabilities());
|
SemanticHighligtingSupport::applyHighlight(document, m_highlights.value(uri), capabilities());
|
||||||
// only replace the assist provider if the language server support it
|
// only replace the assist provider if the language server support it
|
||||||
if (m_serverCapabilities.completionProvider()) {
|
updateCompletionProvider(document);
|
||||||
m_resetAssistProvider[document].completionAssistProvider = document->completionAssistProvider();
|
|
||||||
document->setCompletionAssistProvider(m_clientProviders.completionAssistProvider);
|
|
||||||
}
|
|
||||||
if (m_serverCapabilities.signatureHelpProvider()) {
|
if (m_serverCapabilities.signatureHelpProvider()) {
|
||||||
m_resetAssistProvider[document].functionHintProvider = document->functionHintAssistProvider();
|
m_resetAssistProvider[document].functionHintProvider = document->functionHintAssistProvider();
|
||||||
document->setFunctionHintAssistProvider(m_clientProviders.functionHintProvider);
|
document->setFunctionHintAssistProvider(m_clientProviders.functionHintProvider);
|
||||||
@@ -524,6 +551,11 @@ void Client::documentContentsChanged(TextEditor::TextDocument *document,
|
|||||||
void Client::registerCapabilities(const QList<Registration> ®istrations)
|
void Client::registerCapabilities(const QList<Registration> ®istrations)
|
||||||
{
|
{
|
||||||
m_dynamicCapabilities.registerCapability(registrations);
|
m_dynamicCapabilities.registerCapability(registrations);
|
||||||
|
if (Utils::anyOf(registrations,
|
||||||
|
Utils::equal(&Registration::method, QString(CompletionRequest::methodName)))) {
|
||||||
|
for (auto document : m_openedDocument.keys())
|
||||||
|
updateCompletionProvider(document);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::unregisterCapabilities(const QList<Unregistration> &unregistrations)
|
void Client::unregisterCapabilities(const QList<Unregistration> &unregistrations)
|
||||||
@@ -1119,7 +1151,7 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
|
|||||||
} else if (method == RegisterCapabilityRequest::methodName) {
|
} else if (method == RegisterCapabilityRequest::methodName) {
|
||||||
auto params = dynamic_cast<const RegisterCapabilityRequest *>(content)->params().value_or(RegistrationParams());
|
auto params = dynamic_cast<const RegisterCapabilityRequest *>(content)->params().value_or(RegistrationParams());
|
||||||
if (params.isValid(&error))
|
if (params.isValid(&error))
|
||||||
m_dynamicCapabilities.registerCapability(params.registrations());
|
registerCapabilities(params.registrations());
|
||||||
else
|
else
|
||||||
logError(params);
|
logError(params);
|
||||||
} else if (method == UnregisterCapabilityRequest::methodName) {
|
} else if (method == UnregisterCapabilityRequest::methodName) {
|
||||||
@@ -1260,8 +1292,7 @@ void Client::initializeCallback(const InitializeRequest::Response &initResponse)
|
|||||||
completionProvider->setTriggerCharacters(
|
completionProvider->setTriggerCharacters(
|
||||||
m_serverCapabilities.completionProvider()
|
m_serverCapabilities.completionProvider()
|
||||||
.value_or(ServerCapabilities::CompletionOptions())
|
.value_or(ServerCapabilities::CompletionOptions())
|
||||||
.triggerCharacters()
|
.triggerCharacters());
|
||||||
.value_or(QList<QString>()));
|
|
||||||
}
|
}
|
||||||
if (auto functionHintAssistProvider = qobject_cast<FunctionHintAssistProvider *>(
|
if (auto functionHintAssistProvider = qobject_cast<FunctionHintAssistProvider *>(
|
||||||
m_clientProviders.functionHintProvider)) {
|
m_clientProviders.functionHintProvider)) {
|
||||||
|
@@ -205,6 +205,8 @@ private:
|
|||||||
void resetAssistProviders(TextEditor::TextDocument *document);
|
void resetAssistProviders(TextEditor::TextDocument *document);
|
||||||
void sendPostponedDocumentUpdates();
|
void sendPostponedDocumentUpdates();
|
||||||
|
|
||||||
|
void updateCompletionProvider(TextEditor::TextDocument *document);
|
||||||
|
|
||||||
using ContentHandler = std::function<void(const QByteArray &, QTextCodec *, QString &,
|
using ContentHandler = std::function<void(const QByteArray &, QTextCodec *, QString &,
|
||||||
LanguageServerProtocol::ResponseHandlers,
|
LanguageServerProtocol::ResponseHandlers,
|
||||||
LanguageServerProtocol::MethodHandler)>;
|
LanguageServerProtocol::MethodHandler)>;
|
||||||
|
@@ -451,10 +451,12 @@ bool LanguageClientCompletionAssistProvider::isActivationCharSequence(const QStr
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanguageClientCompletionAssistProvider::setTriggerCharacters(QList<QString> triggerChars)
|
void LanguageClientCompletionAssistProvider::setTriggerCharacters(
|
||||||
|
const Utils::optional<QList<QString>> triggerChars)
|
||||||
{
|
{
|
||||||
m_triggerChars = triggerChars;
|
m_activationCharSequenceLength = 0;
|
||||||
for (const QString &trigger : triggerChars) {
|
m_triggerChars = triggerChars.value_or(QList<QString>());
|
||||||
|
for (const QString &trigger : qAsConst(m_triggerChars)) {
|
||||||
if (trigger.length() > m_activationCharSequenceLength)
|
if (trigger.length() > m_activationCharSequenceLength)
|
||||||
m_activationCharSequenceLength = trigger.length();
|
m_activationCharSequenceLength = trigger.length();
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <texteditor/codeassist/completionassistprovider.h>
|
#include <texteditor/codeassist/completionassistprovider.h>
|
||||||
|
|
||||||
|
#include <utils/optional.h>
|
||||||
|
|
||||||
namespace LanguageClient {
|
namespace LanguageClient {
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
@@ -45,7 +47,7 @@ public:
|
|||||||
bool isActivationCharSequence(const QString &sequence) const override;
|
bool isActivationCharSequence(const QString &sequence) const override;
|
||||||
bool isContinuationChar(const QChar &) const override { return true; }
|
bool isContinuationChar(const QChar &) const override { return true; }
|
||||||
|
|
||||||
void setTriggerCharacters(QList<QString> triggerChars);
|
void setTriggerCharacters(const Utils::optional<QList<QString>> triggerChars);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QString> m_triggerChars;
|
QList<QString> m_triggerChars;
|
||||||
|
@@ -59,9 +59,7 @@ void HoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorWidget,
|
|||||||
{
|
{
|
||||||
if (m_currentRequest.has_value())
|
if (m_currentRequest.has_value())
|
||||||
abort();
|
abort();
|
||||||
if (m_client.isNull()
|
if (m_client.isNull() || !m_client->documentOpen(editorWidget->textDocument())) {
|
||||||
|| !m_client->documentOpen(editorWidget->textDocument())
|
|
||||||
|| !m_client->capabilities().hoverProvider().value_or(false)) {
|
|
||||||
report(Priority_None);
|
report(Priority_None);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,8 @@ LanguageClientManager::LanguageClientManager(QObject *parent)
|
|||||||
JsonRpcMessageHandler::registerMessageProvider<ShowMessageRequest>();
|
JsonRpcMessageHandler::registerMessageProvider<ShowMessageRequest>();
|
||||||
JsonRpcMessageHandler::registerMessageProvider<ShowMessageNotification>();
|
JsonRpcMessageHandler::registerMessageProvider<ShowMessageNotification>();
|
||||||
JsonRpcMessageHandler::registerMessageProvider<WorkSpaceFolderRequest>();
|
JsonRpcMessageHandler::registerMessageProvider<WorkSpaceFolderRequest>();
|
||||||
|
JsonRpcMessageHandler::registerMessageProvider<RegisterCapabilityRequest>();
|
||||||
|
JsonRpcMessageHandler::registerMessageProvider<UnregisterCapabilityRequest>();
|
||||||
connect(EditorManager::instance(), &EditorManager::editorOpened,
|
connect(EditorManager::instance(), &EditorManager::editorOpened,
|
||||||
this, &LanguageClientManager::editorOpened);
|
this, &LanguageClientManager::editorOpened);
|
||||||
connect(EditorManager::instance(), &EditorManager::documentOpened,
|
connect(EditorManager::instance(), &EditorManager::documentOpened,
|
||||||
|
@@ -100,8 +100,9 @@ public:
|
|||||||
|
|
||||||
friend QDebug &operator<<(QDebug &stream, const Comment &comment);
|
friend QDebug &operator<<(QDebug &stream, const Comment &comment);
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &stream, const Comment &comment);
|
QMLDESIGNERCORE_EXPORT friend QDataStream &operator<<(QDataStream &stream,
|
||||||
friend QDataStream &operator>>(QDataStream &stream, Comment &comment);
|
const Comment &comment);
|
||||||
|
QMLDESIGNERCORE_EXPORT friend QDataStream &operator>>(QDataStream &stream, Comment &comment);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_title;
|
QString m_title;
|
||||||
@@ -132,8 +133,10 @@ public:
|
|||||||
|
|
||||||
friend QDebug &operator<<(QDebug &stream, const Annotation &annotation);
|
friend QDebug &operator<<(QDebug &stream, const Annotation &annotation);
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &stream, const Annotation &annotation);
|
QMLDESIGNERCORE_EXPORT friend QDataStream &operator<<(QDataStream &stream,
|
||||||
friend QDataStream &operator>>(QDataStream &stream, Annotation &annotation);
|
const Annotation &annotation);
|
||||||
|
QMLDESIGNERCORE_EXPORT friend QDataStream &operator>>(QDataStream &stream,
|
||||||
|
Annotation &annotation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<Comment> m_comments;
|
QVector<Comment> m_comments;
|
||||||
@@ -142,12 +145,11 @@ private:
|
|||||||
QDebug &operator<<(QDebug &stream, const Comment &comment);
|
QDebug &operator<<(QDebug &stream, const Comment &comment);
|
||||||
QDebug &operator<<(QDebug &stream, const Annotation &annotation);
|
QDebug &operator<<(QDebug &stream, const Annotation &annotation);
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &stream, const Comment &comment);
|
QMLDESIGNERCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const Comment &comment);
|
||||||
QDataStream &operator>>(QDataStream &stream, Comment &comment);
|
QMLDESIGNERCORE_EXPORT QDataStream &operator>>(QDataStream &stream, Comment &comment);
|
||||||
QDataStream &operator<<(QDataStream &stream, const Annotation &annotation);
|
QMLDESIGNERCORE_EXPORT QDataStream &operator<<(QDataStream &stream, const Annotation &annotation);
|
||||||
QDataStream &operator>>(QDataStream &stream, Annotation &annotation);
|
QMLDESIGNERCORE_EXPORT QDataStream &operator>>(QDataStream &stream, Annotation &annotation);
|
||||||
|
} // namespace QmlDesigner
|
||||||
}
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QmlDesigner::Comment);
|
Q_DECLARE_METATYPE(QmlDesigner::Comment);
|
||||||
Q_DECLARE_METATYPE(QmlDesigner::Annotation);
|
Q_DECLARE_METATYPE(QmlDesigner::Annotation);
|
||||||
|
@@ -362,6 +362,10 @@ void CodeCompletionsExtractor::extractAvailability()
|
|||||||
currentCodeCompletion_.availability = CodeCompletion::NotAvailable;
|
currentCodeCompletion_.availability = CodeCompletion::NotAvailable;
|
||||||
break;
|
break;
|
||||||
case CXAvailability_NotAccessible:
|
case CXAvailability_NotAccessible:
|
||||||
|
// QTCREATORBUG-25244
|
||||||
|
if (currentCodeCompletion_.completionKind == CodeCompletion::FunctionDefinitionCompletionKind)
|
||||||
|
currentCodeCompletion_.availability = CodeCompletion::Available;
|
||||||
|
else
|
||||||
currentCodeCompletion_.availability = CodeCompletion::NotAccessible;
|
currentCodeCompletion_.availability = CodeCompletion::NotAccessible;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -158,6 +158,7 @@ protected:
|
|||||||
Document constructorDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_constructor.cpp"), compilationArguments, {}, documents};
|
Document constructorDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_constructor.cpp"), compilationArguments, {}, documents};
|
||||||
Document constructorMemberInitDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_constructorMemberInitialization.cpp"), compilationArguments, {}, documents};
|
Document constructorMemberInitDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_constructorMemberInitialization.cpp"), compilationArguments, {}, documents};
|
||||||
Document briefCommentDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_brief_comment.cpp"), compilationArguments, {}, documents};
|
Document briefCommentDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_brief_comment.cpp"), compilationArguments, {}, documents};
|
||||||
|
Document privateFunctionDefinitionDocument{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_private_function_definition.cpp"), compilationArguments, {}, documents};
|
||||||
};
|
};
|
||||||
|
|
||||||
using CodeCompletionsExtractorSlowTest = CodeCompletionsExtractor;
|
using CodeCompletionsExtractorSlowTest = CodeCompletionsExtractor;
|
||||||
@@ -602,9 +603,12 @@ TEST_F(CodeCompletionsExtractorSlowTest, NotAccessibleFunction)
|
|||||||
unsavedFiles.unsavedFile(functionDocument.filePath()),
|
unsavedFiles.unsavedFile(functionDocument.filePath()),
|
||||||
completeResults.data());
|
completeResults.data());
|
||||||
|
|
||||||
|
// Availability should be NotAccessible, but see QTCREATORBUG-25244.
|
||||||
|
// It's better to offer completion for some non-accessible functions than
|
||||||
|
// not to offer completion for some accessible ones.
|
||||||
ASSERT_THAT(extractor, HasCompletion(Utf8StringLiteral("NotAccessibleFunction"),
|
ASSERT_THAT(extractor, HasCompletion(Utf8StringLiteral("NotAccessibleFunction"),
|
||||||
CodeCompletion::FunctionDefinitionCompletionKind,
|
CodeCompletion::FunctionDefinitionCompletionKind,
|
||||||
CodeCompletion::NotAccessible));
|
CodeCompletion::Available));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CodeCompletionsExtractorSlowTest, NotAvailableFunction)
|
TEST_F(CodeCompletionsExtractorSlowTest, NotAvailableFunction)
|
||||||
@@ -824,6 +828,19 @@ TEST_F(CodeCompletionsExtractorSlowTest, ExtractAll)
|
|||||||
ASSERT_THAT(codeCompletions.empty(), false);
|
ASSERT_THAT(codeCompletions.empty(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(CodeCompletionsExtractorSlowTest, PrivateFunctionDefinition)
|
||||||
|
{
|
||||||
|
ClangCodeCompleteResults completeResults(getResults(privateFunctionDefinitionDocument, 5, 12));
|
||||||
|
|
||||||
|
::CodeCompletionsExtractor extractor(
|
||||||
|
unsavedFiles.unsavedFile(privateFunctionDefinitionDocument.filePath()),
|
||||||
|
completeResults.data());
|
||||||
|
|
||||||
|
ASSERT_THAT(extractor, HasCompletion(Utf8StringLiteral("method"),
|
||||||
|
CodeCompletion::FunctionDefinitionCompletionKind,
|
||||||
|
CodeCompletion::Available));
|
||||||
|
}
|
||||||
|
|
||||||
ClangCodeCompleteResults CodeCompletionsExtractor::getResults(const Document &document,
|
ClangCodeCompleteResults CodeCompletionsExtractor::getResults(const Document &document,
|
||||||
uint line,
|
uint line,
|
||||||
uint column,
|
uint column,
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
class Foo {
|
||||||
|
void method();
|
||||||
|
};
|
||||||
|
|
||||||
|
void Foo::m
|
Reference in New Issue
Block a user