Commit Graph

41 Commits

Author SHA1 Message Date
Christian Kamm
37df3ae5e7 Quickfix: Wrap string literal in QLatin1String(...) 2009-12-22 12:24:06 +01:00
Roberto Raggi
51de95c497 Use the text editor revision to ignore outdated parse results. 2009-12-15 15:52:55 +01:00
Christian Kamm
8269be2ab9 Quickfix: Don't crash on ifstmts with a null statement member. 2009-12-15 10:12:50 +01:00
Christian Kamm
d8427157b2 Quickfix: Disallow semantically invalid splits of if statements. 2009-11-27 14:43:50 +01:00
Christian Kamm
cf975fc308 Quickfix: Use existing parentheses and negate by removing ! if possible. 2009-11-27 11:00:24 +01:00
Christian Kamm
f1af5fb4ef Quickfix: Add two new refactorings for logical binary expressions.
a op b -> !(a invop b)
and
a op b -> b flipop a
2009-11-26 16:04:11 +01:00
Christian Kamm
4c427aec82 Quickfix: Be more efficient when looking up token start/end positions. 2009-11-26 15:00:54 +01:00
Christian Kamm
43129a2928 Quickfix: Add flip helpers. 2009-11-26 14:48:53 +01:00
Christian Kamm
36913baf94 Quickfix: Rewrite existing code to use the new edit operations. 2009-11-26 14:01:08 +01:00
Christian Kamm
80b52e589d Improve ChangeSet to support more rewriting operations. 2009-11-26 12:24:18 +01:00
Roberto Raggi
efdd8ceaa0 Rename applyChangeSet() to apply() 2009-11-25 12:28:22 +01:00
Roberto Raggi
3e93c5eff7 Some more cleanup 2009-11-25 12:22:55 +01:00
Roberto Raggi
d6fa4e2079 Get rid off translationUnit 2009-11-25 12:10:01 +01:00
Roberto Raggi
7edb110e45 Check for valid paths
Reviewed-By: Christian Kamm <christian.d.kamm@nokia.com>
2009-11-25 10:41:11 +01:00
Christian Kamm
d2e7f8e4e6 Quickfix: Don't crash when the AST path is empty. 2009-11-25 10:01:05 +01:00
Roberto Raggi
8545851927 Split create/apply change set. 2009-11-24 12:48:36 +01:00
Roberto Raggi
6594f7a267 Added getters 2009-11-24 12:39:34 +01:00
Roberto Raggi
4abd0aeff3 Removed the extra QTextCursor formal argument from QuickFixOperator::match(). 2009-11-24 11:49:56 +01:00
Roberto Raggi
bab8c94f13 Show the quickfixes in the context menu. 2009-11-23 16:55:25 +01:00
Christian Kamm
67e2ecb663 QuickFix: rename contains->isCursorOn, remove selectNode,selectToken
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2009-11-23 16:18:34 +01:00
Roberto Raggi
ebfe9905ef Quickfix: Added move declaration out of while conditions. 2009-11-23 15:54:24 +01:00
Christian Kamm
b437b4be0f QuickFix: split && correctly when compound statements are involved.
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2009-11-23 13:45:29 +01:00
Christian Kamm
bc92b63ee1 QuickFix: Add braces to a single-line if statement. 2009-11-20 15:24:46 +01:00
Roberto Raggi
2d608342fd Use a `normal' qmap instead of the qmultimap. 2009-11-20 15:19:20 +01:00
Roberto Raggi
ea40dfbf7e Cleanup 2009-11-20 13:08:27 +01:00
Roberto Raggi
1d9af6cc7d Removed the extra check for || when used together with &&. 2009-11-20 11:05:18 +01:00
Roberto Raggi
e825cbfdc9 Active the `split declaration' quickfix op only the declaration has a valid semicolon. 2009-11-20 10:50:19 +01:00
Roberto Raggi
9903b0aedb Added quickfix operation to split simple-declarations. E.g. int a, b; will be replaced with int a; int b;. 2009-11-20 10:47:19 +01:00
Roberto Raggi
3bd33607af QuickFix: move declaration out of if statement condition.
Done-with: ckamm
2009-11-19 17:36:45 +01:00
Roberto Raggi
eec54d4089 Improve if condition splitting.
Done-with: ckamm
2009-11-19 17:07:20 +01:00
Roberto Raggi
040ce975f4 Split or conditions. 2009-11-18 17:31:27 +01:00
Roberto Raggi
a3580db7bc Split if statements. 2009-11-18 17:31:27 +01:00
Roberto Raggi
f3f5ce5e04 Removed HelloQuickFix. 2009-11-18 17:31:27 +01:00
Christian Kamm
8e16ea717a Make more QuickFixOperation helpers available.
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2009-11-18 14:53:35 +01:00
Roberto Raggi
81b0f81cbc Rewrite (!a && !b) as !(a || b). 2009-11-18 12:54:39 +01:00
Christian Kamm
e2ef1d8298 Make the QuickFixOperation interface more useful.
* Rename cursor(unsigned/AST*) to selectToken and selectNode.
  These return a cursor that has the given token or AST node selected.
* Rename getTokenStart/EndPosition to tokenStart/EndPosition.
  Instead of returning line and column numbers, return a position
  usable with text cursors.
* Remove moveAtStart/EndOfToken.

Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2009-11-18 11:28:06 +01:00
Christian Kamm
fd17d2f98f QuickFixOperation: don't pass the text cursor in constructor and apply
Instead, reintroduce setTextCursor and let CPPQuickFixCollector
call it just before invoking apply.

Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2009-11-18 11:10:50 +01:00
Roberto Raggi
5d7def6d2a Refactored the AST visitors.
Now, the ASTVisitor constructor takes a valid reference to a TranslationUnit.
2009-11-17 13:30:39 +01:00
Roberto Raggi
576a1ee31f Build the list of the visible AST nodes (aka AST path). 2009-11-16 16:18:08 +01:00
Roberto Raggi
0b277f2fbe Show how to use the quick fix engine. 2009-11-13 16:43:26 +01:00
Roberto Raggi
c13b8697d2 Introduced the quick fix engine 2009-11-13 16:14:38 +01:00