From fe29651ad4956fd6dac584cbf625f43f9f15a6a2 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 12 Sep 2014 17:16:02 +0200 Subject: [PATCH] let Complete Statement action first finish the live template if any (IDEA-128090) --- .../editorActions/smartEnter/SmartEnterAction.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java index 19fb28086099..436fc3099378 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SmartEnterAction.java @@ -18,6 +18,8 @@ package com.intellij.codeInsight.editorActions.smartEnter; import com.intellij.codeInsight.editorActions.enter.EnterAfterUnmatchedBraceHandler; import com.intellij.codeInsight.lookup.LookupManager; +import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.codeInsight.template.impl.TemplateState; import com.intellij.lang.Language; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; @@ -64,6 +66,11 @@ public class SmartEnterAction extends EditorAction { LookupManager.getInstance(project).hideActiveLookup(); + TemplateState state = TemplateManagerImpl.getTemplateState(editor); + if (state != null) { + state.gotoEnd(); + } + final int caretOffset = editor.getCaretModel().getOffset(); PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);