forked from qt-creator/qt-creator
LSP: fix compile with Qt 6.2
Change-Id: Ia0b83166c9b859add450ae36001f3fa30cfb4b55 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Mathias Hasselmann <mathias@taschenorakel.de>
This commit is contained in:
@@ -3,22 +3,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include "jsonobject.h"
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
|
||||||
#include <QLatin1StringView>
|
|
||||||
#else
|
|
||||||
#include <QLatin1String>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace LanguageServerProtocol {
|
namespace LanguageServerProtocol {
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
|
||||||
using Key = QLatin1StringView;
|
|
||||||
#else
|
|
||||||
using Key = QLatin1String;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr Key actionsKey{"actions"};
|
constexpr Key actionsKey{"actions"};
|
||||||
constexpr Key activeParameterKey{"activeParameter"};
|
constexpr Key activeParameterKey{"activeParameter"};
|
||||||
constexpr Key activeParameterSupportKey{"activeParameterSupport"};
|
constexpr Key activeParameterSupportKey{"activeParameterSupport"};
|
||||||
|
|||||||
@@ -10,8 +10,27 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
#include <QLatin1StringView>
|
||||||
|
#else
|
||||||
|
#include <QLatin1String>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace LanguageServerProtocol {
|
namespace LanguageServerProtocol {
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
using Key = QLatin1StringView;
|
||||||
|
#else
|
||||||
|
class Key : public QLatin1String
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using QLatin1String::QLatin1String;
|
||||||
|
constexpr inline explicit Key(const char *s) noexcept
|
||||||
|
: QLatin1String(s, std::char_traits<char>::length(s))
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class LANGUAGESERVERPROTOCOL_EXPORT JsonObject
|
class LANGUAGESERVERPROTOCOL_EXPORT JsonObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -43,11 +62,6 @@ public:
|
|||||||
const_iterator end() const { return m_jsonObject.end(); }
|
const_iterator end() const { return m_jsonObject.end(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
|
||||||
using Key = QLatin1StringView;
|
|
||||||
#else
|
|
||||||
using Key = QLatin1String;
|
|
||||||
#endif
|
|
||||||
iterator insert(const Key key, const JsonObject &value);
|
iterator insert(const Key key, const JsonObject &value);
|
||||||
iterator insert(const Key key, const QJsonValue &value);
|
iterator insert(const Key key, const QJsonValue &value);
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ using namespace Utils;
|
|||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
using Key = LanguageServerProtocol::Key;
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(clangdLog, "qtc.clangcodemodel.clangd", QtWarningMsg);
|
Q_LOGGING_CATEGORY(clangdLog, "qtc.clangcodemodel.clangd", QtWarningMsg);
|
||||||
Q_LOGGING_CATEGORY(clangdLogAst, "qtc.clangcodemodel.clangd.ast", QtWarningMsg);
|
Q_LOGGING_CATEGORY(clangdLogAst, "qtc.clangcodemodel.clangd.ast", QtWarningMsg);
|
||||||
static Q_LOGGING_CATEGORY(clangdLogServer, "qtc.clangcodemodel.clangd.server", QtWarningMsg);
|
static Q_LOGGING_CATEGORY(clangdLogServer, "qtc.clangcodemodel.clangd.server", QtWarningMsg);
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ IAssistProposal *ClangdFunctionHintProcessor::perform()
|
|||||||
ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &object)
|
ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &object)
|
||||||
: TextDocumentClientCapabilities::CompletionCapabilities(object)
|
: TextDocumentClientCapabilities::CompletionCapabilities(object)
|
||||||
{
|
{
|
||||||
insert(Key{"editsNearCursor"}, true); // For dot-to-arrow correction.
|
insert(LanguageServerProtocol::Key{"editsNearCursor"}, true); // For dot-to-arrow correction.
|
||||||
if (std::optional<CompletionItemCapbilities> completionItemCaps = completionItem()) {
|
if (std::optional<CompletionItemCapbilities> completionItemCaps = completionItem()) {
|
||||||
completionItemCaps->setSnippetSupport(false);
|
completionItemCaps->setSnippetSupport(false);
|
||||||
setCompletionItem(*completionItemCaps);
|
setCompletionItem(*completionItemCaps);
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ public:
|
|||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Key totalKey{"_total"};
|
static constexpr LanguageServerProtocol::Key totalKey{"_total"};
|
||||||
static constexpr Key selfKey{"_self"};
|
static constexpr LanguageServerProtocol::Key selfKey{"_self"};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ using namespace Core;
|
|||||||
|
|
||||||
namespace Coco {
|
namespace Coco {
|
||||||
|
|
||||||
|
using Key = LanguageServerProtocol::Key;
|
||||||
|
|
||||||
CocoLanguageClient::CocoLanguageClient(const FilePath &coco, const FilePath &csmes)
|
CocoLanguageClient::CocoLanguageClient(const FilePath &coco, const FilePath &csmes)
|
||||||
: Client(clientInterface(coco, csmes))
|
: Client(clientInterface(coco, csmes))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace Copilot {
|
|||||||
|
|
||||||
class CheckStatusParams : public LanguageServerProtocol::JsonObject
|
class CheckStatusParams : public LanguageServerProtocol::JsonObject
|
||||||
{
|
{
|
||||||
static constexpr Key optionsKey{"options"};
|
static constexpr LanguageServerProtocol::Key optionsKey{"options"};
|
||||||
static constexpr Key localChecksOnlyKey{"options"};
|
static constexpr LanguageServerProtocol::Key localChecksOnlyKey{"options"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
@@ -30,8 +30,8 @@ public:
|
|||||||
|
|
||||||
class CheckStatusResponse : public LanguageServerProtocol::JsonObject
|
class CheckStatusResponse : public LanguageServerProtocol::JsonObject
|
||||||
{
|
{
|
||||||
static constexpr Key userKey{"user"};
|
static constexpr LanguageServerProtocol::Key userKey{"user"};
|
||||||
static constexpr Key statusKey{"status"};
|
static constexpr LanguageServerProtocol::Key statusKey{"status"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace Copilot {
|
|||||||
|
|
||||||
class Completion : public LanguageServerProtocol::JsonObject
|
class Completion : public LanguageServerProtocol::JsonObject
|
||||||
{
|
{
|
||||||
static constexpr Key displayTextKey{"displayText"};
|
static constexpr LanguageServerProtocol::Key displayTextKey{"displayText"};
|
||||||
static constexpr Key uuidKey{"uuid"};
|
static constexpr LanguageServerProtocol::Key uuidKey{"uuid"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
class GetCompletionParams : public LanguageServerProtocol::JsonObject
|
class GetCompletionParams : public LanguageServerProtocol::JsonObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr Key docKey{"doc"};
|
static constexpr LanguageServerProtocol::Key docKey{"doc"};
|
||||||
|
|
||||||
GetCompletionParams(const LanguageServerProtocol::TextDocumentIdentifier &document,
|
GetCompletionParams(const LanguageServerProtocol::TextDocumentIdentifier &document,
|
||||||
int version,
|
int version,
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
|
|
||||||
class GetCompletionResponse : public LanguageServerProtocol::JsonObject
|
class GetCompletionResponse : public LanguageServerProtocol::JsonObject
|
||||||
{
|
{
|
||||||
static constexpr Key completionKey{"completions"};
|
static constexpr LanguageServerProtocol::Key completionKey{"completions"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
|
|||||||
Reference in New Issue
Block a user