Commit 20aeec73 authored by Christian Kamm's avatar Christian Kamm
Browse files

QuickFix: Add comments to undocumented fixes.

Reviewed-by: Erik Verbruggen
parent 542f21dc
...@@ -354,6 +354,14 @@ private: ...@@ -354,6 +354,14 @@ private:
ASTMatcher matcher; ASTMatcher matcher;
}; };
/*
Rewrite
int *a, b;
As
int *a;
int b;
*/
class SplitSimpleDeclarationOp: public CppQuickFixFactory class SplitSimpleDeclarationOp: public CppQuickFixFactory
{ {
static bool checkDeclaration(SimpleDeclarationAST *declaration) static bool checkDeclaration(SimpleDeclarationAST *declaration)
...@@ -473,7 +481,14 @@ private: ...@@ -473,7 +481,14 @@ private:
/* /*
Add curly braces to a if statement that doesn't already contain a Add curly braces to a if statement that doesn't already contain a
compound statement. compound statement. I.e.
if (a)
b;
becomes
if (a) {
b;
}
*/ */
class AddBracesToIfOp: public CppQuickFixFactory class AddBracesToIfOp: public CppQuickFixFactory
{ {
...@@ -844,9 +859,11 @@ private: ...@@ -844,9 +859,11 @@ private:
/* /*
Replace Replace
"abcd" "abcd" -> QLatin1String("abcd")
With 'a' -> QLatin1Char('a')
QLatin1String("abcd") Except if they are already enclosed in
QLatin1Char, QT_TRANSLATE_NOOP, tr,
trUtf8, QLatin1Literal, QLatin1String
*/ */
class WrapStringLiteral: public CppQuickFixFactory class WrapStringLiteral: public CppQuickFixFactory
{ {
...@@ -951,6 +968,7 @@ private: ...@@ -951,6 +968,7 @@ private:
tr("abcd") or tr("abcd") or
QCoreApplication::translate("CONTEXT", "abcd") or QCoreApplication::translate("CONTEXT", "abcd") or
QT_TRANSLATE_NOOP("GLOBAL", "abcd") QT_TRANSLATE_NOOP("GLOBAL", "abcd")
depending on what is available.
*/ */
class TranslateStringLiteral: public CppQuickFixFactory class TranslateStringLiteral: public CppQuickFixFactory
{ {
...@@ -1286,6 +1304,9 @@ private: ...@@ -1286,6 +1304,9 @@ private:
}; };
}; };
/*
Can be triggered on a class forward declaration to add the matching #include.
*/
class FixForwardDeclarationOp: public CppQuickFixFactory class FixForwardDeclarationOp: public CppQuickFixFactory
{ {
public: public:
...@@ -1411,6 +1432,13 @@ private: ...@@ -1411,6 +1432,13 @@ private:
}; };
}; };
/*
Rewrites
a = foo();
As
Type a = foo();
Where Type is the return type of foo()
*/
class AddLocalDeclarationOp: public CppQuickFixFactory class AddLocalDeclarationOp: public CppQuickFixFactory
{ {
public: public:
......
...@@ -52,6 +52,16 @@ using TextEditor::RefactoringChanges; ...@@ -52,6 +52,16 @@ using TextEditor::RefactoringChanges;
namespace { namespace {
/*
Reformats a one-line object into a multi-line one, i.e.
Item { x: 10; y: 20; width: 10 }
into
Item {
x: 10;
y: 20;
width: 10
}
*/
class SplitInitializerOp: public QmlJSQuickFixFactory class SplitInitializerOp: public QmlJSQuickFixFactory
{ {
public: public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment