boolean (@NotNull InsertionContext context, @NotNull Editor editor, boolean hasValue) { if (myInsideStringLiteral) { int offset = editor.getCaretModel().getOffset(); PsiElement element = context.getFile().findElementAt(offset); int tailOffset = context.getTailOffset(); int guessEndOffset = tailOffset + 1; if (element instanceof LeafPsiElement) { if (handleIncompleteString(editor, element)) return false; int endOffset = element.getTextRange().getEndOffset(); if (endOffset > tailOffset) { context.getDocument().deleteString(tailOffset, endOffset - 1); } } if (hasValue) { return true; } editor.getCaretModel().moveToOffset(guessEndOffset); } else { editor.getCaretModel().moveToOffset(context.getTailOffset()); } return false; }