You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
indentation slightly off when turning AOT query into annotation #1801
Hmm... this is just rewrite's formatting. Should have been continuation indentation which is 2 indents from the previous. I suspect here instead of 2 tabs it is probably 6 because recipe runs 3 times at most. Looks like every time the recipe shifts the text block away by 2 more indents (continuity indentation)
It may get fixed indirectly by switching to the JDT driven refactoring
The topic of formatting text blocks is rather new in Rewrite. I only saw something working for that in 8.72.x. There is a person actively working on formatting in Java and text blocks specifically... It's likely not mature yet and hence there are bugs here and there but it'll get there eventually... I like that Rewrite's formatting has auto-detect per file feature where formatting is inferred from what is in your source file or files rather than a global setting which might be far away from what's in your project's source... I kind doubt this would be available with JDT since ASTs are not LSTs...
With that said, the issue is sadly coming from this autodetect behaviour. Since it works only on one file I parse only that CU and there is only one continuation in this file which is at line 49 with indent value of 42. Once you look at the file you can kind of understand why it picked that format after the query is added. Look at that gorgeous alignment between line 58 and 22-29. Isn't it beautiful? ;-)
I could probably set the continuation ident to the default if becomes unreasonably large number after autodetect. That parameter on line 49 (original code) was probably meant to be aligned with the previous parameter but that is probably not being detected (not planned to be detected) as it is supposed to be a continuation instead. Text blocks have their own alignment feature in rewrite formatter. It is sad though that there is another query with multiline string that should be considered in the continuation indent detection but looks like the AutoDetect ignored that text block although there are 5 (!!!) lines of continuation indents vs 1 on line 49... This is probably another thing to look at.
I tried this again using the latest pre-release on VSCode using the same sample project as above (spring-data-aot from Dan), and that seems to be working again.
I'd consider this fixed... You can still get the offset wrong if you remove the other query in the file. Line 58 would be considered as the "continuation indent" as it is the only candidate... I'd consider this as a rare case though and since this is to be a JDT driven refactoring with indents coming from the setting rather from auto-detection would think this topic closed for now
Activity
martinlippert commentedon Feb 18, 2026
This happens in VSCode as well, but it looks like running this from the
jdt-bean-completion-altbranch works much better...BoykoAlex commentedon Feb 18, 2026
Hmm... this is just rewrite's formatting. Should have been continuation indentation which is 2 indents from the previous. I suspect here instead of 2 tabs it is probably 6 because recipe runs 3 times at most. Looks like every time the recipe shifts the text block away by 2 more indents (continuity indentation)
It may get fixed indirectly by switching to the JDT driven refactoring
BoykoAlex commentedon Feb 18, 2026
The topic of formatting text blocks is rather new in Rewrite. I only saw something working for that in 8.72.x. There is a person actively working on formatting in Java and text blocks specifically... It's likely not mature yet and hence there are bugs here and there but it'll get there eventually... I like that Rewrite's formatting has auto-detect per file feature where formatting is inferred from what is in your source file or files rather than a global setting which might be far away from what's in your project's source... I kind doubt this would be available with JDT since ASTs are not LSTs...
With that said, the issue is sadly coming from this autodetect behaviour. Since it works only on one file I parse only that CU and there is only one continuation in this file which is at line 49 with indent value of 42. Once you look at the file you can kind of understand why it picked that format after the query is added. Look at that gorgeous alignment between line 58 and 22-29. Isn't it beautiful? ;-)
I could probably set the continuation ident to the default if becomes unreasonably large number after autodetect. That parameter on line 49 (original code) was probably meant to be aligned with the previous parameter but that is probably not being detected (not planned to be detected) as it is supposed to be a continuation instead. Text blocks have their own alignment feature in rewrite formatter. It is sad though that there is another query with multiline string that should be considered in the continuation indent detection but looks like the AutoDetect ignored that text block although there are 5 (!!!) lines of continuation indents vs 1 on line 49... This is probably another thing to look at.
martinlippert commentedon Feb 27, 2026
I tried this again using the latest pre-release on VSCode using the same sample project as above (spring-data-aot from Dan), and that seems to be working again.
BoykoAlex commentedon Mar 2, 2026
I'd consider this fixed... You can still get the offset wrong if you remove the other query in the file. Line 58 would be considered as the "continuation indent" as it is the only candidate... I'd consider this as a rare case though and since this is to be a JDT driven refactoring with indents coming from the setting rather from auto-detection would think this topic closed for now