forked from qt-creator/qt-creator
Made trailing slash trigger the next include completion
The completion for the directory wasn't triggered because one of the items matched the typed string, so the list of completion wasn't empty and no new trigger was allowed. By not matching items when a trailing slash is typed, the list is allowed to trigger again from the new location. Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
This commit is contained in:
@@ -1386,6 +1386,12 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio
|
||||
else if (length > 0) {
|
||||
const QString key = m_editor->textAt(m_startPosition, length);
|
||||
|
||||
/* Close on the trailing slash for include completion, to enable the slash to
|
||||
* trigger a new completion list. */
|
||||
if ((m_completionOperator == T_STRING_LITERAL ||
|
||||
m_completionOperator == T_ANGLE_STRING_LITERAL) && key.endsWith(QLatin1Char('/')))
|
||||
return;
|
||||
|
||||
if (m_completionOperator != T_LPAREN) {
|
||||
/*
|
||||
* This code builds a regular expression in order to more intelligently match
|
||||
|
@@ -129,7 +129,7 @@ void CompletionSupport::autoComplete_helper(ITextEditable *editor, bool forced,
|
||||
m_startPosition = m_completionCollector->startCompletion(editor);
|
||||
completionItems = getCompletions();
|
||||
|
||||
QTC_ASSERT(m_startPosition != -1 || completionItems.size() == 0, return);
|
||||
QTC_ASSERT(!(m_startPosition == -1 && completionItems.size() > 0), return);
|
||||
|
||||
if (completionItems.isEmpty()) {
|
||||
cleanupCompletions();
|
||||
|
Reference in New Issue
Block a user