Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
Do not show symbol auto completion when typing: Constant:
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopl committed Apr 14, 2016
1 parent 0d0f870 commit a4f5c1d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions editor/RubyCompletionAssist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ enum KindOfCompletion {
MayBeAIdentifier,
MayBeAMethod,
MayBeConstant,
MayBeASymbol
MayBeASymbol,
MaybeNothing
};

static KindOfCompletion kindOfCompletion(QTextDocument *document, int &startPosition)
Expand All @@ -33,8 +34,12 @@ static KindOfCompletion kindOfCompletion(QTextDocument *document, int &startPosi
startPosition++;
return MayBeAMethod;
}
if (ch == QLatin1Char(':'))
if (ch == QLatin1Char(':')) {
QChar lastChar = document->characterAt(startPosition - 1);
if (lastChar.isLetterOrNumber() || lastChar == QLatin1Char(':'))
return MaybeNothing;
return MayBeASymbol;
}
if (ch.isUpper())
mayBeAConstant = true;
} while (ch.isLetterOrNumber() || ch == QLatin1Char('_'));
Expand Down Expand Up @@ -143,12 +148,13 @@ TextEditor::IAssistProposal *CompletionAssistProcessor::perform(const TextEditor
case MayBeASymbol:
addProposalFromSet(proposals, cm->symbolsIn(fileName), myTyping, m_symbolIcon);
break;
default:
break;
}

if (proposals.empty()) {
return 0;
}

TextEditor::GenericProposalModel *model = new TextEditor::GenericProposalModel;
model->loadContent(proposals);
TextEditor::IAssistProposal *proposal = new TextEditor::GenericProposal(startPosition, model);
Expand Down

0 comments on commit a4f5c1d

Please sign in to comment.