View Issue Details

IDProjectCategoryView StatusLast Update
0038543LazarusIDEpublic2021-06-14 08:01
ReporterOkobaPatino Assigned ToJuha Manninen  
Status closedResolutionno change required 
Product Version2.1 (SVN) 
Summary0038543: JCF Extra spaces
DescriptionFor 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;
TagsNo tags attached.
Fixed in Revision
Attached Files



2021-02-25 11:02

reporter   ~0129157

JCF Format Settings - Clarify - Spaces - Max spaces in code


2021-02-25 14:00

reporter   ~0129159

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.

Domingo Galmés

2021-02-26 20:56

reporter   ~0129181

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,
    ttTo, ttDownTo];
  NoSpaceAfterTokens: TTokenTypeSet = [ttOpenBracket, ttOpenSquareBracket];


2021-02-27 07:56

reporter   ~0129194

> 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.

Domingo Galmés

2021-06-05 15:49

reporter   ~0131160

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.


2021-06-13 13:12

reporter   ~0131289

Thank you.
It seems no fix is needed.

Juha Manninen

2021-06-13 16:41

developer   ~0131291

Ok, resolving.

Issue History

Date Modified Username Field Change
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