wuwuxin 28 Posted April 10, 2022 Any third-party code formatter that can correctly format the inline var? Share this post Link to post
DPStano 15 Posted April 13, 2022 cnpack formater is probably the best one out there, I'm using it daily to format code containing inlines without any problem. Share this post Link to post
dummzeuch 1505 Posted April 14, 2022 On 4/10/2022 at 2:00 AM, wuwuxin said: Any third-party code formatter that can correctly format the inline var? The one in GExperts apparently can do that. I didn't really know but just tested it with: procedure bla; begin for var i: Integer := 0 to List.Count - 1 do begin end; for var i := 0 to List.Count - 1 do begin end; var blub: Integer = 5; Inc(blub); var X := 0.5; var Y := X - 3; end; And this looks fine to me. Share this post Link to post
emileverh 21 Posted April 14, 2022 4 hours ago, dummzeuch said: The one in GExperts apparently can do that. I didn't really know but just tested it with: procedure bla; begin for var i: Integer := 0 to List.Count - 1 do begin end; for var i := 0 to List.Count - 1 do begin end; var blub: Integer = 5; Inc(blub); var X := 0.5; var Y := X - 3; end; And this looks fine to me. With the default code formatter, it goes 'wrong' when you skip the type: var settings := dtmSettings.ReadRecord; Or.... var settings : TSettings := dtmSettings.ReadRecord; Share this post Link to post
dummzeuch 1505 Posted April 14, 2022 23 minutes ago, emileverh said: With the default code formatter, it goes 'wrong' when you skip the type: var settings := dtmSettings.ReadRecord; Or.... var settings : TSettings := dtmSettings.ReadRecord; I'm not sure what you're trying to tell me. I had such an example in my test: var X := 0.5; and it seems to work. This was with the "twm" settings because that's what I use. I haven't tried any of the others. Share this post Link to post
emileverh 21 Posted April 14, 2022 3 hours ago, dummzeuch said: I'm not sure what you're trying to tell me. I had such an example in my test: var X := 0.5; and it seems to work. This was with the "twm" settings because that's what I use. I haven't tried any of the others. May be I am too quick with my answer. .. sorry! The default built in ( IDE ) source code formatter does it wrong. I did not try the GEXPERTS formatter ( until now ) Share this post Link to post