TextEditor: Make text snippets available in all editors

... that do not define their own completion assist provider

Change-Id: I8edb65647a55178d4388b26c95cdeb301ff9f3fa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2017-07-26 10:53:37 +02:00
parent d68f258754
commit c7abc41d97
3 changed files with 43 additions and 3 deletions

View File

@@ -57,6 +57,7 @@
#include <texteditor/codeassist/assistinterface.h>
#include <texteditor/codeassist/codeassistant.h>
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/keywordscompletionassist.h>
#include <texteditor/generichighlighter/context.h>
#include <texteditor/generichighlighter/highlightdefinition.h>
#include <texteditor/generichighlighter/highlighter.h>
@@ -8263,6 +8264,7 @@ void TextEditorFactory::setParenthesesMatchingEnabled(bool on)
IEditor *TextEditorFactory::createEditor()
{
static KeywordsCompletionAssistProvider basicSnippetProvider;
TextDocumentPtr doc(d->m_documentCreator());
if (d->m_indenterCreator)
@@ -8271,7 +8273,8 @@ IEditor *TextEditorFactory::createEditor()
if (d->m_syntaxHighlighterCreator)
doc->setSyntaxHighlighter(d->m_syntaxHighlighterCreator());
doc->setCompletionAssistProvider(d->m_completionAssistProvider);
doc->setCompletionAssistProvider(d->m_completionAssistProvider ? d->m_completionAssistProvider
: &basicSnippetProvider);
return d->createEditorHelper(doc);
}