palantir-java-format icon indicating copy to clipboard operation
palantir-java-format copied to clipboard

Formatter on/off config disregarded by Palentir IntelliJ's plugin

Open mfillon opened this issue 9 months ago • 0 comments

IntelliJ's version: 2025.1.1.1 (Ultimate Edition) Plugin version: 2.67.0

Issue

Given formatter off/on comment is enabled in IntelliJ's configuration (Settings>Editor > Code Style > Formatter tab):

Image

With a code as follow (Spring security config is a good example where we don't want any auto-formatting):

        // @formatter:off
        return http.csrf(CsrfConfigurer::disable)
            .authorizeHttpRequests(authz -> authz.requestMatchers(
                    "/actuator/**", 
                    "/error")
                        .permitAll()
                    .anyRequest().authenticated())
                .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
            .build();
        // @formatter:on

Expected behaviour

Code between formatter off/on comments should not be formatted by Palentir formatter.

Actual behaviour

Code is formatted by Palentir formatter. But it is properly ignored by IntelliJ's default formatter.

mfillon avatar May 16 '25 12:05 mfillon