Result (@NotNull PsiFile file, @NotNull Editor editor, @NotNull Ref<Integer> caretOffset, @NotNull Ref<Integer> caretAdvance, @NotNull DataContext dataContext, EditorActionHandler originalHandler) { // this call is not related to YAMLEnterAtIndentHandler, but is needed for `YAMLInjectedElementEnterHandler` // this call is placed here to avoid creating another `EnterHandlerDelegate` with `order="first"` YAMLInjectedElementEnterHandlerKt.preserveIndentStateBeforeProcessing(file, dataContext); if (!(file instanceof YAMLFile)) { return Result.Continue; } if (caretOffset.get() > 0 && shouldInsertAutomaticHyphen(file)) { PsiElement element = file.findElementAt(caretOffset.get() - 1); if (PsiUtilCore.getElementType(element) == TokenType.WHITE_SPACE && element.getTextLength() == 1 && PsiUtilCore.getElementType(PsiTreeUtil.prevLeaf(element)) == YAMLTokenTypes.SEQUENCE_MARKER) { int indentSize = Objects.requireNonNull(CodeStyle.getLanguageSettings(file, YAMLLanguage.INSTANCE).getIndentOptions()).INDENT_SIZE; editor.getDocument().replaceString(caretOffset.get() - 2, caretOffset.get(), StringUtil.repeat(" ", indentSize)); return Result.Stop; } } // honor dedent (RUBY-21803) // The solutions is copied from com.jetbrains.python.editor.PyEnterAtIndentHandler if (BackspaceHandler.isWhitespaceBeforeCaret(editor)) { return Result.DefaultSkipIndent; } return Result.Continue; }