dummzeuch 1505 Posted October 1, 2022 (edited) There are currently some unit tests for the GExperts code formatter that fail. It all depends on how spaces after comments {comment} or (*comment*) are handled. A How should the code formatter handle the following code: procedure bla; begin {some comment} SomeStatement; end; A1 Keep the space after the comment: procedure bla; begin {some comment} SomeStatement; end; A2 Remove the space after the comment: procedure bla; begin {some comment}SomeStatement; end; B what about this code: procedure bla; begin {some comment}SomeStatement; end; B1 should the formatter leave it as is? B2 should it insert a space, so it gets changed into: procedure bla; begin {some comment} SomeStatement; end; C what about this code with multiple spaces after the comment: procedure bla; begin {some comment} SomeStatement; end; C1 should the formatter remove the spaces: procedure bla; begin {some comment}SomeStatement; end; C2 or should it reduce them to one space: procedure bla; begin {some comment} SomeStatement; end; C3 or should it leave them as them as they are: procedure bla; begin {some comment} SomeStatement; end; The current code will always remove the spaces, so its A2, B1 and C1. I'm tending towards keeping the number of spaces as they are, that would be A1, B1 and C3. I'm definitely not going to make this configurable. I wouldn't even know how to describe this configuration option. Edited October 1, 2022 by dummzeuch Share this post Link to post
Attila Kovacs 629 Posted October 1, 2022 (edited) 13 minutes ago, dummzeuch said: I wouldn't even know how to describe this configuration option. why not? you could name it "The option I didn't want to implement #4223" Edited October 1, 2022 by Attila Kovacs 1 Share this post Link to post
baka0815 12 Posted October 10, 2022 (edited) I would also prefer a setting: 1. No space 2. Space 3. Line break 4. leave untouched I personally would prefer the "1 space" variant, but I would also not want to have a comment on the left of a statement. I would prefer the comment above or on the right. Edited October 10, 2022 by baka0815 1 Share this post Link to post
uligerhardt 18 Posted January 12, 2023 I think leaving the spaces as is (C3) may be the least annoying solution. Share this post Link to post
Sourcemaker 0 Posted November 27, 2023 Hi, the leave untouched option or disable all spacing is needed fot me. Is there any option? Share this post Link to post
eivindbakkestuen 47 Posted December 8, 2023 On 10/1/2022 at 8:38 PM, dummzeuch said: A How should the code formatter handle the following code: Throw an error because the line starts with a comment. Share this post Link to post
Ian Branch 127 Posted December 8, 2023 If they must code like that, :-(, make it one space after the comment. Share this post Link to post
corneliusdavid 214 Posted December 8, 2023 Personally, I think a space after the comment makes it a little more readable. So I would opt for A1, B2, C2. But more importantly, I think comments should follow code or be on a separate line--I think comments before code on the same line break the vertical continuity of a block of code, causing the statement to be missed when the eye scans down a page. Therefore, like baka0815, I would much prefer a line-break option to move the statement to the next line. Share this post Link to post