summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2017-03-23 14:00:09 +0100
committerTim Jenssen <tim.jenssen@qt.io>2017-03-23 17:26:06 +0000
commit535cc76cacba44871e0201973a9dfa5750ba476f (patch)
tree9b2ad6e74fcc8ba209b9a9c85f1bec3dfba586f3 /src/plugins/clangcodemodel
parenta9012ce747d11621d75919199f2b3858a2534b4d (diff)
downloadqt-creator-535cc76cacba44871e0201973a9dfa5750ba476f.tar.gz
Clang: Avoid dot-arrow-correction if dot is gone
Change-Id: Iba23a17ba9345ed4f08e16faad02054903c04afc Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel')
-rw-r--r--src/plugins/clangcodemodel/clangassistproposal.cpp5
-rw-r--r--src/plugins/clangcodemodel/clangassistproposal.h4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/clangcodemodel/clangassistproposal.cpp b/src/plugins/clangcodemodel/clangassistproposal.cpp
index 19fe708bbc..b70b56b794 100644
--- a/src/plugins/clangcodemodel/clangassistproposal.cpp
+++ b/src/plugins/clangcodemodel/clangassistproposal.cpp
@@ -35,12 +35,13 @@ ClangAssistProposal::ClangAssistProposal(int cursorPos, TextEditor::GenericPropo
{
}
-bool ClangAssistProposal::isCorrective() const
+bool ClangAssistProposal::isCorrective(TextEditor::TextEditorWidget *editorWidget) const
{
auto clangAssistProposalModel = static_cast<ClangAssistProposalModel*>(model());
return clangAssistProposalModel->neededCorrection()
- == ClangBackEnd::CompletionCorrection::DotToArrowCorrection;
+ == ClangBackEnd::CompletionCorrection::DotToArrowCorrection
+ && editorWidget->textAt(basePosition() - 1, 1) == ".";
}
void ClangAssistProposal::makeCorrection(TextEditor::TextEditorWidget *editorWidget)
diff --git a/src/plugins/clangcodemodel/clangassistproposal.h b/src/plugins/clangcodemodel/clangassistproposal.h
index 8fc29b8374..70b5f15ca2 100644
--- a/src/plugins/clangcodemodel/clangassistproposal.h
+++ b/src/plugins/clangcodemodel/clangassistproposal.h
@@ -37,8 +37,8 @@ class ClangAssistProposal : public TextEditor::GenericProposal
public:
ClangAssistProposal(int cursorPos, TextEditor::GenericProposalModel *model);
- virtual bool isCorrective() const;
- virtual void makeCorrection(TextEditor::TextEditorWidget *editorWidget);
+ bool isCorrective(TextEditor::TextEditorWidget *editorWidget) const override;
+ void makeCorrection(TextEditor::TextEditorWidget *editorWidget) override;
};
} // namespace Internal