Commit 9412b138 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

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: default avatarDaniel Molkentin <daniel.molkentin@nokia.com>
parent 5271117e
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment