Commit Graph

1095 Commits

Author SHA1 Message Date
kuity 48b9dcf5ae Added KT-4549 SwapBinaryExpression Intention 2014-03-25 15:55:53 +04:00
Ross Hanson 55e888604e KT-4568: Created the ConvertNegatedExpressionWithDemorgansLaw intention. Converts an expression of the form !(a &&,|| b) to its expanded equivalent under DeMorgan's law. 2014-03-25 10:25:47 +04:00
Ross Hanson 2147a88ed8 KT-4568: Created the ConvertNegatedBooleanSequence intention. This intention takes an expression of the form !a &&,|| !b &&,|| ... and converts it to the DeMorgan equivalent !(a &&,|| b ...). 2014-03-25 10:25:47 +04:00
Tal Man 1c2082fd19 Don't create empty parentheses when lambda is the only argument 2014-03-24 18:20:01 +04:00
Steven Allen d198465522 Add an intention to simplify negated binary expressions
Given an expression of the form `!(a op b)`, replace it with `a !op b`.

For example:

    !(a < b)    -> a >= b
    !(a is Int) -> a !is int
2014-03-19 12:10:28 -04:00
Tal Man baac1b9b0b Fix to a bug in the intention to move lambda expressions inside parentheses, type arguments were being deleted 2014-03-18 19:25:50 +04:00
asedunov 85dbd8cf49 Merge pull request #410 from kuity/unnecessaryParensInWhenToIf
Fix KT-4385 "Unnecessary parentheses in "replace when with if"
2014-03-17 13:00:10 +01:00
Lingzhang 877b9f2d99 KT4385 Bug Fix for Unnecessary Parentheses in WhenToIfIntention 2014-03-13 21:26:03 -04:00
Zack Grannan 3862a3b5bc Added ifThenToSafeAccessIntention 2014-03-12 16:02:56 +04:00
Zack Grannan 1f720c8559 Added safeAccessToIfThen intention 2014-03-12 16:02:55 +04:00
Zack Grannan 1ca4bb0e79 Added ifThenToElvisIntention 2014-03-12 16:02:55 +04:00
Zack Grannan 673369affe Added elvisToIfThenIntention 2014-03-12 16:02:54 +04:00
Steven Allen 84a8911822 Add replacement intentions for operator functions
Add intentions for replacing attribute calls that correspond to
overloadable operators with their respective operators.

This commit includes call replacements for:
 * Binary Infix Operators: plus, minus, times, rangeTo, mod, div
 * Unary Prefix Operators: plus, minus, not
 * Array Index Operator: get
 * In Operator: contains
2014-03-10 11:15:11 -04:00
gavinkeusch 2f613638c2 KT-4562 New Intention: Add and Remove braces from control statements that have single line bodies 2014-03-06 23:45:45 +04:00
Tuomas Tynkkynen 8ce0d43118 Add intention for converting an implicit 'it' parameter to an explicitly named parameter
Kotlin's function literals have a shortcut for one-argument literals:
the single argument doesn't need to be explicitly named, but can be
referred via the 'it' contextual keyword. Add an intention action for
converting an implicit 'it' parameter to an explicitly named one.

For example, 'array(1, 2, 3).filter { it % 2 == 0 }'
          -> 'array(1, 2, 3).filter { x -> x % 2 == 0 }'
2014-03-05 17:31:25 +04:00
Tuomas Tynkkynen c6d6a32314 Add intention for replacing explicit function literal parameter with 'it'
Kotlin's function literals have a shortcut for one-argument literals:
the single argument doesn't need to be explicitly named, but can be
referred via the 'it' contextual keyword.

For example, 'array(1, 2, 3).filter { x -> x % 2 == 0 }'
          -> 'array(1, 2, 3).filter { it % 2 == 0 }'

Add an intention action for this transformation.
2014-03-05 17:31:21 +04:00
Tal Man 8cf965db7e 2 intentions for moving lambda functions;
moves lambda functions in function calls inside and outside of the
parenthesis: foo({ it }) <-> foo() { it }
2014-03-04 20:07:42 +04:00
Valentin Kipyatkov a2f6b99862 Convert to block body intention action 2014-03-04 19:13:54 +04:00
Alexander Udalov f7b6457139 Replace "jet" package name with "kotlin" in testData 2014-03-02 19:55:26 +04:00
Tal Man 89779b5013 2 Intentions for string templates:
the first removes curly braces from a simple name variable, ${x} -> $x
and the second does the opposite $x -> ${x}
2014-02-24 21:20:40 +04:00
Pradyoth Kukkapalli 44234c7c0a New Intention Action: Replace a dot-qualified function call with an infix function call. 2014-02-14 00:18:09 -05:00
Pradyoth Kukkapalli 8b6bd8a184 New Intention Action: Replace an infix function call with a dot qualified method call. 2014-02-09 09:05:19 -08:00
Tuomas Tynkkynen 9ce40cd17b Fix unnecessary parenthesis around 'this' in refactorings
Operator priority calculation for 'this' expressions was incorrect in
JetPsiUtil.getPriority(): it would return a very low value for
a JetThisExpression, causing the IDE to report that parenthesis
are necessary in an expression like '(this)[1]'.

Fix this by making JetThisExpression not implement
JetStatementExpression by removing the implements clause from
JetLabelQualifiedInstanceExpression and adding it to all other
subclasses of JetLabelQualifiedInstanceExpression.

Fixes KT-4513.
2014-02-09 17:22:27 +04:00
Alexey Sedunov 2ea1a89e4c Specify type explicitly: Add tests 2014-02-04 14:42:37 +04:00
Valentin Kipyatkov 020ea99220 Intention "Convert to expression body" 2014-01-23 18:50:26 +04:00
Valentin Kipyatkov d01ff28212 Quickfix and intention tests refactoring: refer to intention action by class when checking that it's not available (instead of listing all available actions) 2014-01-23 18:46:27 +04:00
Valentin Kipyatkov 3028cec4cd More correct code transformations: do not perform formatter's job on yourself 2014-01-23 18:46:26 +04:00
Valentin Kipyatkov ee62d318ee Fixed bug in reference shortening 2013-12-25 20:01:07 +04:00
Alexey Sedunov 9f5ee13c20 Implement "Merge when" intention 2013-11-20 20:55:58 +04:00
Alexey Sedunov eff62bfd83 KT-4008 'Replace if with when' is available but does not work 2013-10-11 17:24:07 +04:00
Andrey Breslav 8bf1ab85ab Intention to replace a shorthand type with a reconstructed one 2013-09-13 22:41:06 +02:00
Andrey Breslav 3002ac96f0 Supported converting member properties to extensions
Additionally, we now generate <selection>throw UnsupportedOperationException()</selection> when a missing body is added
2013-08-27 15:03:27 +04:00
Andrey Breslav c02f0a7d04 Intention to convert a member to an extension 2013-08-27 15:03:27 +04:00
Nikolay Krasko 3fd265e34a Remove assert about error type for removing type annotation 2013-08-16 18:28:06 +04:00
Alexey Sedunov 6f942a21de Move intention-related classes and tests to "intentions" directory 2013-06-13 20:19:38 +04:00
Mikhael Bogdanov 49bbbe1a0b Test update after 'Specify explicitly type' action refactoring 2013-02-26 18:34:43 +04:00
Evgeny Gerashchenko c4bda6a260 KT-3000 "Specify Type Explicitly" action works wrong for Enum
#KT-3000 fixed
2012-10-29 21:51:02 +04:00
Evgeny Gerashchenko 4e05bee22a Fixed case for intention actions texts. 2012-10-29 21:51:02 +04:00
Andrey Breslav 5eaa5b396b Removing usages of tuples from test data
(KT-2358 Drop tuples)
 #KT-2358 In progress
2012-09-18 20:27:09 +04:00
Svetlana Isakova 0d1790a4f4 alternative signature applies for names
mapped in standard library (and differs from auto transformed Java signature)
e.g.Collections.copy(MutableList, List)
2012-09-13 17:28:31 +04:00
Svetlana Isakova 7d37df5f38 tests changes after collections mapping 2012-09-05 18:55:16 +04:00
Alexander.Podkhalyuzin b5b9f7ba98 Fixed broken testdata. 2012-05-23 15:58:12 +04:00
Evgeny Gerashchenko 5846123de1 Made "Remove Explicitly Specified Type" available on property type. 2012-05-03 21:15:55 +04:00
Evgeny Gerashchenko d9fc85f6f5 Added test for "Specify type explicitly" for loop parameters.
#KT-1890 fixed
2012-05-03 21:04:43 +04:00
Evgeny Gerashchenko c0b78cd635 Added tests for SpecifyTypeExplicitlyAction. 2012-05-03 20:51:42 +04:00