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:
Thorbjørn Lindeijer
2009-07-24 14:32:39 +02:00
parent 5271117e5b
commit 9412b138b6
2 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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();