View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0038543||Lazarus||IDE||public||2021-02-25 09:01||2021-06-14 08:01|
|Reporter||OkobaPatino||Assigned To||Juha Manninen|
|Status||closed||Resolution||no change required|
|Product Version||2.1 (SVN)|
|Summary||0038543: JCF Extra spaces|
|Description||For this code:|
if True then Exit;
If I add two or more space after then, after reformat, JCF makes them two space, but if I add just one space, it will keep it as one.
Almost the same thing happens for this:
with Self do;
This time JCF keeps two space before Self if I write more than one space. This will not happen for spaces after Self or after do.
I do not know about other cases, but I think it can be good to do make it more coordinated.
In the "Steps To Reproduce" is the test code, try reformatting it to see extra spaces. Then try to remove them and reformat again. It seems JCF chooses one or two spaces, if this is a need, it should be an option for it and I could not find one existing.
|Steps To Reproduce|| if True then Exit;|
with Self do Exit;
|Tags||No tags attached.|
|Fixed in Revision|
||JCF Format Settings - Clarify - Spaces - Max spaces in code|
Yes but JCF does not keep this option all the time. For example the "Max spaces in code" default value is set to 2 for me.
In the example, It will reduce space count before "Self" to two, but for after of "Self" it will reduce spaces to one anyway.
Please check the sample for more clarification.
It works as designed, JCF only permits one space before or after some tokens.
"then" and "do" are part of those tokens.
> with Self do Exit;
>but for after of "Self" it will reduce spaces to one anyway.
is not after "Self", is before "do" so only allows one space.
I think that no changes are required.
The tokens are:
SingleSpaceAfterTokens: TTokenTypeSet = [ttColon, ttAssign, ttComma,
ttPlusAssign, ttMinusAssign, ttTimesAssign, ttFloatDivAssign];
SingleSpaceAfterWords: TTokenTypeSet = [ ttProcedure, ttFunction,
ttConstructor, ttDestructor, ttProperty,
ttOf, ttDo, ttWhile, ttUntil, ttCase, ttIf, ttTo, ttDownTo, ttGeneric];
SingleSpaceBeforeWords: TTokenTypeSet = [ttEquals, ttThen, ttOf, ttDo,
NoSpaceAfterTokens: TTokenTypeSet = [ttOpenBracket, ttOpenSquareBracket];
> It works as designed, JCF only permits one space before or after some tokens.
Any info on why it is working that way? It seems disordered.
I think formatter should act alike no matter developer typed one or two spaces by mistake.
I think that a more homogeneous behavior can be achieved by setting JCF Format Settings - Clarify - Spaces - Max spaces in code to 1.
So there will always be one space regardless of what the programmer has typed.
I think that it is not necessary to make modifications in code.
It seems no fix is needed.
|2021-02-25 09:01||OkobaPatino||New Issue|
|2021-02-25 11:02||delfion||Note Added: 0129157|
|2021-02-25 14:00||OkobaPatino||Note Added: 0129159|
|2021-02-26 20:56||Domingo Galmés||Note Added: 0129181|
|2021-02-27 07:56||OkobaPatino||Note Added: 0129194|
|2021-06-05 15:49||Domingo Galmés||Note Added: 0131160|
|2021-06-13 13:12||OkobaPatino||Note Added: 0131289|
|2021-06-13 16:41||Juha Manninen||Assigned To||=> Juha Manninen|
|2021-06-13 16:41||Juha Manninen||Status||new => resolved|
|2021-06-13 16:41||Juha Manninen||Resolution||open => no change required|
|2021-06-13 16:41||Juha Manninen||LazTarget||=> -|
|2021-06-13 16:41||Juha Manninen||Note Added: 0131291|
|2021-06-14 08:01||OkobaPatino||Status||resolved => closed|