forked from qt-creator/qt-creator
Editor: move ownership of assist interface to processor
This way the base class can manage the lifetime of the interface object and it doesn't need to be done in each implementation of perform. Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -143,7 +143,8 @@ public:
|
||||
|
||||
QSet<QString> identifiers() const;
|
||||
|
||||
AssistInterface *createAssistInterface(AssistKind assistKind, AssistReason reason) const override;
|
||||
std::unique_ptr<AssistInterface> createAssistInterface(AssistKind assistKind,
|
||||
AssistReason reason) const override;
|
||||
|
||||
private:
|
||||
void updateDocumentNow();
|
||||
@@ -343,16 +344,17 @@ int languageVariant(const QString &type)
|
||||
return variant;
|
||||
}
|
||||
|
||||
AssistInterface *GlslEditorWidget::createAssistInterface(
|
||||
std::unique_ptr<AssistInterface> GlslEditorWidget::createAssistInterface(
|
||||
AssistKind kind, AssistReason reason) const
|
||||
{
|
||||
if (kind == Completion)
|
||||
return new GlslCompletionAssistInterface(textCursor(),
|
||||
textDocument()->filePath(),
|
||||
reason,
|
||||
textDocument()->mimeType(),
|
||||
m_glslDocument);
|
||||
return TextEditorWidget::createAssistInterface(kind, reason);
|
||||
if (kind != Completion)
|
||||
return TextEditorWidget::createAssistInterface(kind, reason);
|
||||
|
||||
return std::make_unique<GlslCompletionAssistInterface>(textCursor(),
|
||||
textDocument()->filePath(),
|
||||
reason,
|
||||
textDocument()->mimeType(),
|
||||
m_glslDocument);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user