Commit a457124c authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo
Browse files

CodeAssist: Expand prefix only when it's a completion

Quickfixes, for instance, should not be expanded.

Change-Id: I832ea11c5a270ee290441aca0d2c7231d0ced013
Reviewed-on: http://codereview.qt.nokia.com/674

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristian Kamm <christian.d.kamm@nokia.com>
parent 42c9175d
......@@ -315,6 +315,7 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
this, SLOT(processProposalItem(IAssistProposalItem*)));
m_proposalWidget->setAssistant(m_q);
m_proposalWidget->setReason(reason);
m_proposalWidget->setKind(m_assistKind);
m_proposalWidget->setUnderlyingWidget(m_textEditor->widget());
m_proposalWidget->setModel(m_proposal->model());
m_proposalWidget->setDisplayRect(m_textEditor->cursorRect(m_proposal->basePosition()));
......
......@@ -132,10 +132,11 @@ void FunctionHintProposalWidget::setAssistant(CodeAssistant *assistant)
m_d->m_assistant = assistant;
}
void FunctionHintProposalWidget::setReason(AssistReason reason)
{
Q_UNUSED(reason);
}
void FunctionHintProposalWidget::setReason(AssistReason)
{}
void FunctionHintProposalWidget::setKind(AssistKind)
{}
void FunctionHintProposalWidget::setUnderlyingWidget(const QWidget *underlyingWidget)
{
......
......@@ -51,6 +51,7 @@ public:
virtual void setAssistant(CodeAssistant *assistant);
virtual void setReason(AssistReason reason);
virtual void setKind(AssistKind kind);
virtual void setUnderlyingWidget(const QWidget *underlyingWidget);
virtual void setModel(IAssistProposalModel *model);
virtual void setDisplayRect(const QRect &rect);
......
......@@ -241,6 +241,7 @@ public:
bool m_isSynchronized;
bool m_explicitlySelected;
AssistReason m_reason;
AssistKind m_kind;
bool m_justInvoked;
QPointer<GenericProposalInfoFrame> m_infoFrame;
QTimer m_infoTimer;
......@@ -349,6 +350,11 @@ void GenericProposalWidget::setReason(AssistReason reason)
m_d->m_justInvoked = true;
}
void GenericProposalWidget::setKind(AssistKind kind)
{
m_d->m_kind = kind;
}
void GenericProposalWidget::setUnderlyingWidget(const QWidget *underlyingWidget)
{
setFont(underlyingWidget->font());
......@@ -452,6 +458,7 @@ bool GenericProposalWidget::updateAndCheck(const QString &prefix)
}
if (TextEditorSettings::instance()->completionSettings().m_partiallyComplete
&& m_d->m_kind == Completion
&& m_d->m_justInvoked
&& m_d->m_isSynchronized) {
if (m_d->m_model->size() == 1) {
......
......@@ -52,6 +52,7 @@ public:
virtual void setAssistant(CodeAssistant *assistant);
virtual void setReason(AssistReason reason);
virtual void setKind(AssistKind kind);
virtual void setUnderlyingWidget(const QWidget *underlyingWidget);
virtual void setModel(IAssistProposalModel *model);
virtual void setDisplayRect(const QRect &rect);
......
......@@ -55,6 +55,7 @@ public:
virtual void setAssistant(CodeAssistant *assistant) = 0;
virtual void setReason(AssistReason reason) = 0;
virtual void setKind(AssistKind kind) = 0;
virtual void setUnderlyingWidget(const QWidget *underlyingWidget) = 0;
virtual void setModel(IAssistProposalModel *model) = 0;
virtual void setDisplayRect(const QRect &rect) = 0;
......
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