palantir / palantir/palantir-java-format
Formatter on/off config disregarded by Palentir IntelliJ's plugin
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 907
- Forks
- 101
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 19
Description
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):
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with Palantir Java Format 2.67.0 and IntelliJ IDEA 2025.1.1.1 using the formatter off/on comments shown in the report. Start by locating the formatter's handling of these comments and compare it with IntelliJ's behavior; done means code between the markers remains unchanged while code outside them is formatted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100