CppEditor: Offer class-level quickfixes also when clicking "in class"

That is, allow the cursor to on some "neutral" place in the body of the
declaration, not only strictly on the class name.

Fixes: QTCREATORBUG-15699
Change-Id: I74ad6048c16c19d418446c990178535d878fc630
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-20 17:08:31 +02:00
parent ffb5a3977f
commit f515672ffd
3 changed files with 34 additions and 35 deletions

View File

@@ -538,6 +538,11 @@ public:
m_classAST = path.at(index)->asClassSpecifier();
}
}
// Also offer the operation if we are on some "empty" part of the class declaration.
if (!m_classAST)
m_classAST = path.at(pathSize - 1)->asClassSpecifier();
if (!m_classAST || !m_classAST->base_clause_list)
return;