View Issue Details

IDProjectCategoryView StatusLast Update
0038543LazarusIDEpublic2021-02-27 08:56
ReporterOkobaPatino Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
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
LazTarget
Widgetset
Attached Files

Activities

delfion

2021-02-25 12:02

reporter   ~0129157

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

OkobaPatino

2021-02-25 15: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 21: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];

OkobaPatino

2021-02-27 08: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.

Issue History

Date Modified Username Field Change
2021-02-25 10:01 OkobaPatino New Issue
2021-02-25 12:02 delfion Note Added: 0129157
2021-02-25 15:00 OkobaPatino Note Added: 0129159
2021-02-26 21:56 Domingo Galmés Note Added: 0129181
2021-02-27 08:56 OkobaPatino Note Added: 0129194