Added JetCallableDeclaration.getColon()

This commit is contained in:
Valentin Kipyatkov
2014-10-23 21:15:42 +04:00
parent d13fd19a63
commit 357ea7a995
8 changed files with 41 additions and 6 deletions
@@ -55,7 +55,7 @@ public class ConvertToExpressionBodyAction : PsiElementBaseIntentionAction() {
if (declaration.hasDeclaredReturnType() && declaration is JetCallableDeclaration && canOmitType(declaration)) {
val typeRef = declaration.getTypeReference()!!
val colon = typeRef.siblings(forward = false, withItself = false).first { it.getNode().getElementType() == JetTokens.COLON }
val colon = declaration.getColon()!!
val range = TextRange(colon.getTextRange().getStartOffset(), typeRef.getTextRange().getEndOffset())
editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset())
editor.getCaretModel().moveToOffset(range.getEndOffset())