With the option "Register as the IDE's code formatter (Format Source command)" from feature request #269 (revision #5857) enabled in Delphi 13.2, running the IDE's Format Source command (Ctrl+D or the editor's context menu) loses most bookmarks of the file and moves the rest to wrong lines. Breakpoints are moved correctly.
Steps to reproduce:
Open a unit where formatting adds lines, e.g.:
procedure Foo;
var i: integer;
begin
if True then begin Foo; Foo; end;
i := 1; Foo;
end;
procedure Bar;
begin
Foo;
end;
Set bookmarks on several lines, including one on a line before the first change (e.g. on "procedure Foo;").
Result (measured in the 32-bit IDE): of five bookmarks, four were removed, including the one on the unchanged line, and the remaining one ended up 5 lines too far down. Two breakpoints set at the same time were on the correct lines afterwards.
For a moment after formatting, the bookmarks were on the lines the formatter's offset mapping points to; shortly afterwards they were moved again or removed. It is not yet known whether this is caused by GExperts or by the IDE.
Only DLLs compiled from the sources since revision #5857 are affected; no release contains this feature yet.
Investigated with temporary logging in the formatter and a test package that logs the bookmark positions every 50 ms:
GetStoredOffsetsForFormatter), and GExperts maps all of them to the correct new lines.So this appears to be an IDE problem, possibly in the bookmark handling Embarcadero added in Delphi 13 (formerly the Parnassus Bookmarks plugin). When the Code Formatter expert is called directly (its own shortcut or the GExperts editor popup menu) instead of through the IDE's Format Source, it has a workaround for the same IDE behaviour since revision #5778: it records the bookmarks again after the IDE has moved them. That workaround is not applied to the IDE integration for now.