Title: Partial formatting: re-indent statements outside the range to match the formatted output · Issue #182 · openjavaformat/open-java-format · GitHub
Open Graph Title: Partial formatting: re-indent statements outside the range to match the formatted output · Issue #182 · openjavaformat/open-java-format
X Title: Partial formatting: re-indent statements outside the range to match the formatted output · Issue #182 · openjavaformat/open-java-format
Description: Upstream: google/google-java-format#1503 Kind: idea | Priority: low google-java-format#1503 (merged 2026-10-29, copybara export) addresses --lines / --offset formatting: when an edit adds or removes a block nesting level, statements outs...
Open Graph Description: Upstream: google/google-java-format#1503 Kind: idea | Priority: low google-java-format#1503 (merged 2026-10-29, copybara export) addresses --lines / --offset formatting: when an edit adds or remove...
X Description: Upstream: google/google-java-format#1503 Kind: idea | Priority: low google-java-format#1503 (merged 2026-10-29, copybara export) addresses --lines / --offset formatting: when an edit adds or remove...
Opengraph URL: https://github.com/openjavaformat/open-java-format/issues/182
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Partial formatting: re-indent statements outside the range to match the formatted output","articleBody":"**Upstream:** https://github.com/google/google-java-format/pull/1503 \n**Kind:** idea | **Priority:** low\n\n[google-java-format#1503](https://github.com/google/google-java-format/pull/1503) (merged 2026-10-29, copybara export) addresses `--lines` / `--offset` formatting: when an edit adds or removes a block nesting level, statements outside the requested range kept their old indentation and ended up misaligned with their closing braces. With `--cleanup` on, every unformatted statement-level segment that starts on its own line is now shifted as a unit to its formatted indentation, keeping its inner line breaks. Text blocks and other multi-line tokens are untouched, and a check ensures only leading whitespace changes. A separate upstream commit (f7eeb776a343a4e1d65d1ce229c837773257e276) also fixes leftover double blank lines after removing an unused import in partial mode (see [google-java-format#1436](https://github.com/google/google-java-format/issues/1436) and [google-java-format#598](https://github.com/google/google-java-format/issues/598), both closed 2026-10-29).\n\nWhy it matters: IDE users format only the changed lines, which is exactly this case. We should check whether our range formatting leaves the same misalignment and the same double blank line after unused-import removal.\n\nAffected files in our repo:\n- open-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java (range formatting)\n- open-java-format/src/main/java/com/palantir/javaformat/java/RemoveUnusedImports.java\n- open-java-format/src/main/java/com/palantir/javaformat/java/JavaOutput.java\n\nSuggested action: investigate. Try both scenarios in our formatter; adopt the idea only if the problem reproduces. Examples: not available - the exact test inputs are in a 700-line test diff and I did not derive our output.\n\n---\n_Filed from an upstream-watch ticket after manual review._","author":{"url":"https://github.com/abashev","@type":"Person","name":"abashev"},"datePublished":"2026-11-01T18:20:15Z","url":"https://github.com/openjavaformat/open-java-format/issues/182"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:47536949-7da6-02c9-0430-d13e43956ab6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D72C:6188:2BAA15:39F385:6AFBB793 |
| html-safe-nonce | 624580b27bcee1f8f9833f211da46c1a954e76f9ae9d8d9fe39893a64b924c20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzJDOjYxODg6MkJBQTE1OjM5RjM4NTo2QUZCQjc5MyIsInZpc2l0b3JfaWQiOiI1NDg2NDgxOTA1MzQ5ODAxODc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 598d400093a21018181359e8df76c9cb04830c482dae3a5717bd8229e20b5e23 |
| hovercard-subject-tag | issue:6150408453 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openjavaformat/open-java-format/182/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ed992b8dbe0ba1a9ca16297e4ec6027594defcac7c6713b94c01a0ff3d7feb22/openjavaformat/open-java-format/issues/182 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ed992b8dbe0ba1a9ca16297e4ec6027594defcac7c6713b94c01a0ff3d7feb22/openjavaformat/open-java-format/issues/182 |
| og:image:alt | Upstream: google/google-java-format#1503 Kind: idea | Priority: low google-java-format#1503 (merged 2026-10-29, copybara export) addresses --lines / --offset formatting: when an edit adds or remove... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abashev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/openjavaformat/open-java-format git https://github.com/openjavaformat/open-java-format.git |
| octolytics-dimension-user_id | 325177626 |
| octolytics-dimension-user_login | openjavaformat |
| octolytics-dimension-repository_id | 1288055459 |
| octolytics-dimension-repository_nwo | openjavaformat/open-java-format |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 214273098 |
| octolytics-dimension-repository_parent_nwo | palantir/palantir-java-format |
| octolytics-dimension-repository_network_root_id | 214273098 |
| octolytics-dimension-repository_network_root_nwo | palantir/palantir-java-format |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width