void (char c, @NotNull Editor editor, @NotNull PsiFile file) { if (c != ':' || !JsonEditorOptions.getInstance().AUTO_WHITESPACE_AFTER_COLON) { if (c != ' ') { myWhitespaceAdded = false; } return; } int offset = editor.getCaretModel().getOffset(); PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument()); PsiElement element = PsiTreeUtil.getParentOfType(PsiTreeUtil.skipWhitespacesBackward(file.findElementAt(offset)), JsonProperty.class, false); if (element == null) { myWhitespaceAdded = false; return; } final ASTNode[] children = element.getNode().getChildren(TokenSet.create(JsonElementTypes.COLON)); if (children.length == 0) { myWhitespaceAdded = false; return; } final ASTNode colon = children[0]; final ASTNode next = colon.getTreeNext(); final String text = next.getText(); if (text.length() == 0 || !StringUtil.isEmptyOrSpaces(text) || StringUtil.isLineBreak(text.charAt(0))) { final int insOffset = colon.getStartOffset() + 1; editor.getDocument().insertString(insOffset, " "); editor.getCaretModel().moveToOffset(insOffset + 1); myWhitespaceAdded = true; } else { myWhitespaceAdded = false; } }