Closed iBicha closed 1 year ago
Ah. Yeah, I think this is because it thinks the for
is the start of a for loop. The formatter is not overly smart. :) Yeah, we need to fix this.
Looking at it, it seems like a matter of adding an exception to "continue for" and "exit for" in https://github.com/rokucommunity/brighterscript-formatter/blob/master/src/formatters/IndentFormatter.ts if I understand the problem correctly
Yeah, that looks like the right spot to fix it. Would you be interested in submitting a pull request to fix this?
It might take me a while since I'm pretty new to brighterscript parser and tokens etc.
I'm not sure if this should be hardcoded or added as a token to https://github.com/rokucommunity/brighterscript-formatter/blob/master/src/constants.ts
I don't see a ContinueFor
in CompositeKeywords
so kinda unsure. And interestingly same is for ContinueWhile
which not present but also reproduces the issue.
Also I don't see a these two composite tokens in TokenKind
from bs, so kinda not sure where the best way/place to fix - I'm too new to the system!
@TwitchBronBron I opened a PR with a pretty naive approach
@iBicha this should have been included in the latest vscode release. Can you confirm it's working for you?
Before
After