Commit 6d0f973f authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Better name for method to pick the completion collector

isValid -> supportsEditor
parent 607f622c
......@@ -508,14 +508,11 @@ static int startOfOperator(TextEditor::ITextEditable *editor,
return start;
}
bool CppCodeCompletion::isValid(TextEditor::ITextEditable *editor)
bool CppCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
{ return m_manager->isCppEditor(editor); }
bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
{
if (! m_manager->isCppEditor(editor)) // ### remove me
return false;
const int pos = editor->position();
if (startOfOperator(editor, pos, /*token =*/ 0,
/*want function call=*/ true) != pos)
......
......@@ -58,7 +58,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
public:
explicit CppCodeCompletion(CppModelManager *manager);
bool isValid(TextEditor::ITextEditable *editor);
bool supportsEditor(TextEditor::ITextEditable *editor);
bool triggersCompletion(TextEditor::ITextEditable *editor);
int startCompletion(TextEditor::ITextEditable *editor);
void completions(QList<TextEditor::CompletionItem> *completions);
......
......@@ -84,7 +84,7 @@ public slots:
private slots:
void handleExpandCollapseToolButton(bool checked);
void handleJumpToSearchResult(int index, const QString &fileName, int lineNumber,
int searchTermStart, int searchTermLength);
int searchTermStart, int searchTermLength);
private:
void readSettings();
......
......@@ -22,7 +22,7 @@ Qt::CaseSensitivity QtScriptCodeCompletion::caseSensitivity() const
void QtScriptCodeCompletion::setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
{ m_caseSensitivity = caseSensitivity; }
bool QtScriptCodeCompletion::isValid(TextEditor::ITextEditable *editor)
bool QtScriptCodeCompletion::supportsEditor(TextEditor::ITextEditable *editor)
{
if (qobject_cast<ScriptEditor *>(editor->widget()))
return true;
......
......@@ -21,7 +21,7 @@ public:
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity);
virtual bool isValid(TextEditor::ITextEditable *editor);
virtual bool supportsEditor(TextEditor::ITextEditable *editor);
virtual bool triggersCompletion(TextEditor::ITextEditable *editor);
virtual int startCompletion(TextEditor::ITextEditable *editor);
virtual void completions(QList<TextEditor::CompletionItem> *completions);
......
......@@ -94,7 +94,7 @@ void CompletionSupport::autoComplete(ITextEditable *editor, bool forced)
m_completionCollector = 0;
foreach (ICompletionCollector *collector, m_completionCollectors) {
if (collector->isValid(editor)) {
if (collector->supportsEditor(editor)) {
m_completionCollector = collector;
break;
}
......
......@@ -80,7 +80,7 @@ public:
/*
* Returns true if this completion collector can be used with the given editor.
*/
virtual bool isValid(ITextEditable *editor) = 0;
virtual bool supportsEditor(ITextEditable *editor) = 0;
/* This method should return whether the cursor is at a position which could
* trigger an autocomplete. It will be called each time a character is typed in
......
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