forked from qt-creator/qt-creator
C++: Disable "Replace Dot for Arrow" auto-correction for ObjC sources
In the light of Obj-C properties this seems to annoy more than to help. Change-Id: I48f92d505035369f48e8798d0972ef00306bdde0 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -422,14 +422,15 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
|
||||
|
||||
TextEditor::IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
|
||||
ProjectExplorer::Project *project, BaseTextEditor *editor, QTextDocument *document,
|
||||
int position, TextEditor::AssistReason reason) const
|
||||
bool isObjCEnabled, int position, TextEditor::AssistReason reason) const
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
QTC_ASSERT(editor, return 0);
|
||||
QTC_ASSERT(document, return 0);
|
||||
|
||||
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(editor, document, position, reason,
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(editor, document, isObjCEnabled,
|
||||
position, reason,
|
||||
modelManager->workingCopy());
|
||||
}
|
||||
|
||||
@@ -1409,10 +1410,14 @@ bool CppCompletionAssistProcessor::completeMember(const QList<CPlusPlus::LookupI
|
||||
|
||||
ResolveExpression resolveExpression(context);
|
||||
|
||||
bool *replaceDotForArrow = 0;
|
||||
if (!m_interface->isObjCEnabled())
|
||||
replaceDotForArrow = &m_model->m_replaceDotForArrow;
|
||||
|
||||
if (ClassOrNamespace *binding =
|
||||
resolveExpression.baseExpression(baseResults,
|
||||
m_model->m_completionOperator,
|
||||
&m_model->m_replaceDotForArrow)) {
|
||||
replaceDotForArrow)) {
|
||||
if (binding)
|
||||
completeClass(binding, /*static lookup = */ true);
|
||||
|
||||
|
||||
@@ -94,13 +94,12 @@ class InternalCompletionAssistProvider : public CppCompletionAssistProvider
|
||||
public:
|
||||
TextEditor::IAssistProcessor *createProcessor() const QTC_OVERRIDE;
|
||||
|
||||
TextEditor::IAssistInterface *createAssistInterface(
|
||||
ProjectExplorer::Project *project,
|
||||
TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
|
||||
TextEditor::BaseTextEditor *editor,
|
||||
QTextDocument *document,
|
||||
bool isObjCEnabled,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const QTC_OVERRIDE;
|
||||
|
||||
};
|
||||
|
||||
class CppCompletionAssistProcessor : public TextEditor::IAssistProcessor
|
||||
@@ -175,12 +174,14 @@ class CppCompletionAssistInterface : public TextEditor::DefaultAssistInterface
|
||||
public:
|
||||
CppCompletionAssistInterface(TextEditor::BaseTextEditor *editor,
|
||||
QTextDocument *textDocument,
|
||||
bool isObjCEnabled,
|
||||
int position,
|
||||
TextEditor::AssistReason reason,
|
||||
const CppModelManagerInterface::WorkingCopy &workingCopy)
|
||||
: TextEditor::DefaultAssistInterface(textDocument, position, editor->document()->filePath(),
|
||||
reason)
|
||||
, m_editor(editor)
|
||||
, m_isObjCEnabled(isObjCEnabled)
|
||||
, m_gotCppSpecifics(false)
|
||||
, m_workingCopy(workingCopy)
|
||||
{}
|
||||
@@ -194,12 +195,15 @@ public:
|
||||
const QStringList &frameworkPaths)
|
||||
: TextEditor::DefaultAssistInterface(textDocument, position, fileName, reason)
|
||||
, m_editor(0)
|
||||
, m_isObjCEnabled(false)
|
||||
, m_gotCppSpecifics(true)
|
||||
, m_snapshot(snapshot)
|
||||
, m_includePaths(includePaths)
|
||||
, m_frameworkPaths(frameworkPaths)
|
||||
{}
|
||||
|
||||
bool isObjCEnabled() const { return m_isObjCEnabled; }
|
||||
|
||||
const CPlusPlus::Snapshot &snapshot() const { getCppSpecifics(); return m_snapshot; }
|
||||
const QStringList &includePaths() const { getCppSpecifics(); return m_includePaths; }
|
||||
const QStringList &frameworkPaths() const { getCppSpecifics(); return m_frameworkPaths; }
|
||||
@@ -208,6 +212,7 @@ private:
|
||||
void getCppSpecifics() const;
|
||||
|
||||
TextEditor::BaseTextEditor *m_editor;
|
||||
mutable bool m_isObjCEnabled;
|
||||
mutable bool m_gotCppSpecifics;
|
||||
CppModelManagerInterface::WorkingCopy m_workingCopy;
|
||||
mutable CPlusPlus::Snapshot m_snapshot;
|
||||
|
||||
@@ -62,7 +62,8 @@ public:
|
||||
|
||||
virtual TextEditor::IAssistInterface *createAssistInterface(
|
||||
ProjectExplorer::Project *project, TextEditor::BaseTextEditor *editor,
|
||||
QTextDocument *document, int position, TextEditor::AssistReason reason) const = 0;
|
||||
QTextDocument *document, bool isObjCEnabled, int position,
|
||||
TextEditor::AssistReason reason) const = 0;
|
||||
|
||||
static int activationSequenceChar(const QChar &ch, const QChar &ch2,
|
||||
const QChar &ch3, unsigned *kind,
|
||||
|
||||
Reference in New Issue
Block a user