Why does not IDEA allow (gives warnings) formattin...
# announcements
j
Why does not IDEA allow (gives warnings) formatting builder chains like this?
Copy code
http
    .antMatcher("/api/**")
    .cors()
        .and()
    .exceptionHandling()
        .authenticationEntryPoint(UnauthorizedAuthenticationEntryPoint())
        .and()
    .sessionManagement()
        .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
        .and()
OK the snippet is not very clear here but the point is without any indents in builder chain they are annoying to read
s
i guess because it doesn’t want to enforce a specific format. But you can use CTRL+ALT+L to fix it.
j
CTRL+ALT+L makes it the way I don't like it to be
but I can't find IDEA formatter setting which causes the warnings in the first case
g
Probably this is setting of Editor -> Code Style -> Warning
c
When doing custom formatting like that, surround the code with @formatter:off/on comments:
Copy code
//@formatter:off
	val a = 0
		val b = 1
	val c = 2
			val d = 3
	//@formatter:on
This will prevent IntelliJ from reformatting it, given that you have formatter markers enabled in
File | Settings | Editor | Code Style
2
🤯 1