forked from qt-creator/qt-creator
CppEditor: Follow Symbol Under Cursor opens the preprocessor dialog
... when invoked on a macro that is defined inside that dialog. Change-Id: I419c6675d70cfb8dd174f6a33f502b4c584baa3a Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -454,16 +454,18 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toLatin1();
|
||||
if (macro->name() == name)
|
||||
return link; //already on definition!
|
||||
} else {
|
||||
const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1);
|
||||
if (use && use->macro().fileName() != CppModelManagerInterface::configurationFileName()) {
|
||||
} else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) {
|
||||
const QString fileName = use->macro().fileName();
|
||||
if (fileName == CppModelManagerInterface::editorConfigurationFileName()) {
|
||||
m_widget->showPreProcessorWidget();
|
||||
} else if (fileName != CppModelManagerInterface::configurationFileName()) {
|
||||
const Macro ¯o = use->macro();
|
||||
link.targetFileName = macro.fileName();
|
||||
link.targetLine = macro.line();
|
||||
link.linkTextStart = use->begin();
|
||||
link.linkTextEnd = use->end();
|
||||
return link;
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
// Find the last symbol up to the cursor position
|
||||
|
||||
@@ -175,6 +175,11 @@ static CppModelManagerInterface *g_instance = 0;
|
||||
const QString CppModelManagerInterface::configurationFileName()
|
||||
{ return CPlusPlus::Preprocessor::configurationFileName; }
|
||||
|
||||
const QString CppModelManagerInterface::editorConfigurationFileName()
|
||||
{
|
||||
return QLatin1String("<per-editor-defines>");
|
||||
}
|
||||
|
||||
CppModelManagerInterface::CppModelManagerInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
@@ -216,6 +216,7 @@ public:
|
||||
|
||||
public:
|
||||
static const QString configurationFileName();
|
||||
static const QString editorConfigurationFileName();
|
||||
|
||||
public:
|
||||
CppModelManagerInterface(QObject *parent = 0);
|
||||
|
||||
@@ -138,7 +138,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
|
||||
workingCopy.insert(configurationFileName, m_configFile);
|
||||
m_snapshot.remove(m_fileInEditor);
|
||||
|
||||
static const QString editorDefinesFileName = QLatin1String("<per-editor-defines>");
|
||||
static const QString editorDefinesFileName
|
||||
= CppModelManagerInterface::editorConfigurationFileName();
|
||||
if (editorDefinesChanged) {
|
||||
m_snapshot.remove(editorDefinesFileName);
|
||||
workingCopy.insert(editorDefinesFileName, m_editorDefines);
|
||||
|
||||
Reference in New Issue
Block a user