forked from qt-creator/qt-creator
LSP: do not potentially call the move assignment operator twice
This was caused by a diamond shaped inheritance hierarchy. Remove this hierarchy by copying all accessor functions to the specialized class. Change-Id: I877ee22a944a188bbcedda22de33a528529bf423 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -159,12 +159,6 @@ bool TextDocumentRegistrationOptions::filterApplies(const Utils::FileName &fileN
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServerCapabilities::RegistrationOptions::isValid(QStringList *error) const
|
|
||||||
{
|
|
||||||
return TextDocumentRegistrationOptions::isValid(error)
|
|
||||||
&& StaticRegistrationOptions::isValid(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TextDocumentSyncOptions::isValid(QStringList *error) const
|
bool TextDocumentSyncOptions::isValid(QStringList *error) const
|
||||||
{
|
{
|
||||||
return checkOptional<bool>(error, openCloseKey)
|
return checkOptional<bool>(error, openCloseKey)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
{ return checkOptional<bool>(error, resolveProviderKey); }
|
{ return checkOptional<bool>(error, resolveProviderKey); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentRegistrationOptions : public virtual JsonObject
|
class LANGUAGESERVERPROTOCOL_EXPORT TextDocumentRegistrationOptions : public JsonObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
@@ -198,7 +198,7 @@ public:
|
|||||||
|
|
||||||
using ColorProviderOptions = JsonObject;
|
using ColorProviderOptions = JsonObject;
|
||||||
|
|
||||||
class LANGUAGESERVERPROTOCOL_EXPORT StaticRegistrationOptions : public virtual JsonObject
|
class LANGUAGESERVERPROTOCOL_EXPORT StaticRegistrationOptions : public JsonObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using JsonObject::JsonObject;
|
using JsonObject::JsonObject;
|
||||||
@@ -245,12 +245,27 @@ public:
|
|||||||
{ insert(definitionProviderKey, definitionProvider); }
|
{ insert(definitionProviderKey, definitionProvider); }
|
||||||
void clearDefinitionProvider() { remove(definitionProviderKey); }
|
void clearDefinitionProvider() { remove(definitionProviderKey); }
|
||||||
|
|
||||||
class LANGUAGESERVERPROTOCOL_EXPORT RegistrationOptions
|
class LANGUAGESERVERPROTOCOL_EXPORT RegistrationOptions : public JsonObject
|
||||||
: public TextDocumentRegistrationOptions, public StaticRegistrationOptions
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using TextDocumentRegistrationOptions::TextDocumentRegistrationOptions;
|
using JsonObject::JsonObject;
|
||||||
bool isValid(QStringList *error) const override;
|
|
||||||
|
LanguageClientArray<DocumentFilter> documentSelector() const
|
||||||
|
{ return clientArray<DocumentFilter>(documentSelectorKey); }
|
||||||
|
void setDocumentSelector(const LanguageClientArray<DocumentFilter> &documentSelector)
|
||||||
|
{ insert(documentSelectorKey, documentSelector.toJson()); }
|
||||||
|
|
||||||
|
bool filterApplies(const Utils::FileName &fileName,
|
||||||
|
const Utils::MimeType &mimeType = Utils::MimeType()) const;
|
||||||
|
|
||||||
|
// The id used to register the request. The id can be used to deregister
|
||||||
|
// the request again. See also Registration#id.
|
||||||
|
Utils::optional<QString> id() const { return optionalValue<QString>(idKey); }
|
||||||
|
void setId(const QString &id) { insert(idKey, id); }
|
||||||
|
void clearId() { remove(idKey); }
|
||||||
|
|
||||||
|
bool isValid(QStringList *error) const override
|
||||||
|
{ return checkArray<DocumentFilter>(error, documentSelectorKey) && checkOptional<bool>(error, idKey); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// The server provides Goto Type Definition support.
|
// The server provides Goto Type Definition support.
|
||||||
|
|||||||
Reference in New Issue
Block a user