Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single level of indentation after multiple colon-separated statement openers #176

Open
dkearns opened this issue Aug 4, 2021 · 3 comments

Comments

@dkearns
Copy link
Contributor

dkearns commented Aug 4, 2021

It appears to be a reasonably common style to format nested statements, usually loops, like this:

WHILE 0: WHILE 0
    PRINT "42"
WEND: WEND

Whether this is good style is, hopefully, a question for another day. However, I've noticed that the IDE is currently indenting the contained statement block once for each level of statement nesting.

The aim of this formatting style is presumably to keep things compact so I was wondering if it might be better to use a single level of indentation here?

I noticed this because my inherited legacy code, which uses this style heavily, was formatted with a single indent level.

Thanks,
Doug

@FellippeHeitor
Copy link
Contributor

You will probably hate what happens with:

FOR i = 1 TO 10
    FOR j = 1 TO 10
        PRINT a
NEXT j, i

I still think it's all behaving as expected.

@dkearns
Copy link
Contributor Author

dkearns commented Aug 4, 2021

No, I think that's the only sensible way to format your example (i.e., the indent level should be relative to the line above).

FWIW, having a quick look through my QB64 samples archive I note at least one example in wetspot.bas but you could probably find examples of any formatting you like in that archive.

@FellippeHeitor
Copy link
Contributor

Changes previously applied with 1e67962 have been reverted until a more stable solution can be found.

Sample code giving issues:

FOR y%% = 0 TO 3: FOR x%% = 0 TO 7
    IF 1 THEN
        PRINT
        END IF
NEXT x%%, y%%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants