void (InsertionContext context, Editor editor, String defaultValue, List<Object> values, JsonSchemaType type, String comma, JsonLikePsiWalker walker, boolean insertColon) { if (!walker.requiresValueQuotes() && defaultValue != null) { defaultValue = StringUtil.unquoteString(defaultValue); } final boolean isNumber = type != null && (JsonSchemaType._integer.equals(type) || JsonSchemaType._number.equals(type)) || type == null && (defaultValue != null && !StringUtil.isQuotedString(defaultValue) || values != null && ContainerUtil.and(values, v -> !(v instanceof String))); boolean hasValues = !ContainerUtil.isEmpty(values); boolean hasDefaultValue = !StringUtil.isEmpty(defaultValue); boolean hasQuotes = isNumber || !walker.requiresValueQuotes(); int offset = editor.getCaretModel().getOffset(); CharSequence charSequence = editor.getDocument().getCharsSequence(); final String ws = charSequence.length() > offset && charSequence.charAt(offset) == ' ' ? "" : " "; final String colonWs = insertColon ? ":" + ws : ws; String stringToInsert = colonWs + (hasDefaultValue ? defaultValue : (hasQuotes ? "" : "\"\"")) + comma; EditorModificationUtil.insertStringAtCaret(editor, stringToInsert, false, true, insertColon ? 2 : 1); if (!hasQuotes || hasDefaultValue) { SelectionModel model = editor.getSelectionModel(); int caretStart = model.getSelectionStart(); int newOffset = caretStart + (hasDefaultValue ? defaultValue.length() : 1); if (hasDefaultValue && !hasQuotes) newOffset--; model.setSelection(hasQuotes ? caretStart : (caretStart + 1), newOffset); editor.getCaretModel().moveToOffset(newOffset); } if (!walker.hasWhitespaceDelimitedCodeBlocks() && !stringToInsert.equals(colonWs + comma)) { formatInsertedString(context, stringToInsert.length()); } if (hasValues) { AutoPopupController.getInstance(context.getProject()).autoPopupMemberLookup(context.getEditor(), null); } }