forked from qt-creator/qt-creator
C++: Fine-tune auto insertion of '}'
Do not insert for these cases:
* <Cursor>{
* namespace X <Cursor>
* if the next block is indented, like e.g.:
if (e) <Cursor>
g();
* on empty line if text before looks like a finished statement or
scope opening/end
Change-Id: Id9decc1e964a775724a929c2a3e79b5283105560
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -30,7 +30,10 @@
|
||||
#include <cplusplus/Token.h>
|
||||
#include <cplusplus/CPlusPlusForwardDeclarations.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||
QT_FORWARD_DECLARE_CLASS(QTextBlock)
|
||||
QT_FORWARD_DECLARE_CLASS(QChar)
|
||||
|
||||
namespace CPlusPlus {
|
||||
@@ -38,8 +41,11 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT MatchingText
|
||||
{
|
||||
public:
|
||||
using IsNextBlockDeeperIndented = std::function<bool(const QTextBlock &textBlock)>;
|
||||
static bool contextAllowsAutoParentheses(const QTextCursor &cursor,
|
||||
const QString &textToInsert);
|
||||
const QString &textToInsert,
|
||||
IsNextBlockDeeperIndented isNextIndented
|
||||
= IsNextBlockDeeperIndented());
|
||||
static bool contextAllowsAutoQuotes(const QTextCursor &cursor,
|
||||
const QString &textToInsert);
|
||||
static bool contextAllowsElectricCharacters(const QTextCursor &cursor);
|
||||
|
||||
Reference in New Issue
Block a user