From 0bf164da7eaf9dca7addc88680be5f755fcbadf7 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 28 Sep 2016 18:44:23 +0200 Subject: [PATCH] java call completion: remove untouched argument placeholders in a command --- .../codeInsight/completion/JavaMethodCallElement.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index 09b57555cd23..065527c55642 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -25,6 +25,7 @@ import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateState; import com.intellij.featureStatistics.FeatureUsageTracker; +import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.event.DocumentAdapter; @@ -288,7 +289,8 @@ public class JavaMethodCallElement extends LookupItem implements Type TextRange endRange = templateState.getVariableRange(template.getVariableNameAt(template.getVariableCount() - 1)); if (startRange == null || endRange == null) return; - editor.getDocument().deleteString(startRange.getStartOffset(), endRange.getEndOffset()); + WriteCommandAction.runWriteCommandAction(editor.getProject(), () -> + editor.getDocument().deleteString(startRange.getStartOffset(), endRange.getEndOffset())); } }); }