CodeAssist: Do not retrigger completion when applying a snippet

This fixes the following case for the ClangCodeModel:

 1. Trigger non-member/non-prefix completion.
 2. Choose the generic "class" snippet.
    --> The snippet is inserted, cursor is right after "name", but it
        also triggers another completion that proposes e.g. the "namespace"
        snippet.

This does not happen with the built-in code model because at that cursor
position it provides "name" as completion result, which is a perfect
match and thus suppresses the completion list.

Change-Id: I2f797469b2a0952406b50c28f9704b113e19b16d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-06-12 10:03:06 +02:00
parent 43d6726c70
commit e8ce2e62d2

View File

@@ -350,7 +350,8 @@ void CodeAssistantPrivate::processProposalItem(AssistProposalItemInterface *prop
TextDocumentManipulator manipulator(m_editorWidget);
proposalItem->apply(manipulator, m_proposal->basePosition());
destroyContext();
process();
if (!proposalItem->isSnippet())
process();
}
void CodeAssistantPrivate::handlePrefixExpansion(const QString &newPrefix)