forked from qt-creator/qt-creator
Added snippet expansion to the C++ code completion.
This commit is contained in:
@@ -1623,8 +1623,17 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
{
|
{
|
||||||
Symbol *symbol = 0;
|
Symbol *symbol = 0;
|
||||||
|
|
||||||
if (item.data.isValid())
|
if (item.data.isValid()) {
|
||||||
|
if (item.data.canConvert<QString>()) {
|
||||||
|
TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(m_editor->widget());
|
||||||
|
QTextCursor tc = edit->textCursor();
|
||||||
|
tc.setPosition(m_startPosition, QTextCursor::KeepAnchor);
|
||||||
|
edit->insertCodeSnippet(tc, item.data.toString());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
symbol = item.data.value<Symbol *>();
|
symbol = item.data.value<Symbol *>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString toInsert;
|
QString toInsert;
|
||||||
QString extraChars;
|
QString extraChars;
|
||||||
|
|||||||
Reference in New Issue
Block a user