Indent for Java builder
One often use Builder classes to create hierarchical data in Java. E.g.
JsonObject value = new JsonBuilder()
.beginObject()
.add("firstName", "John")
.add("lastName", "Smith")
.add("age", 25)
.beginObject("address")
.add("streetAddress", "21 2nd Street")
.add("city", "New York")
.add("state", "NY")
.add("postalCode", "10021")
.endObject()
.beginArray("phoneNumber")
.beginObject()
.add("type", "home")
.add("number", "212 555-1234")
.endObject()
.beginObject()
.add("type", "home")
.add("number", "646 555-4567")
.endObject()
.endArray()
.endObject()
.build();
Unfortunately IntelliJ removes the indent from the continuation lines when you auto-format or copy this code. Does anyone know of an option (or a plugin) that would allow to keep the manual indentation for lines that start with a dot ?
Please sign in to leave a comment.
Hi achim,
There is no such IJ code style facility.
However, it looks like this ticket would suit your needs here - IDEA-55419. It's planned for the v.12 release at the moment. Feel free to track its progress.
Denis
Thanks for your reply, Denis. I'll look forward to v.12 then.
B-)