-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
caddyfile: Fix caddy fmt
nesting not decrementing
#4157
Conversation
This is an extremely weird edge-case where if you had a environment variable {} on one line, a comment on the next line, and the closing of the block on the following line; the rest of the Caddyfile would be indented further than it should've been. ref; caddyserver/vscode-caddyfile#13
caddy fmt
nesting not decrementing
Thanks for the quick PR! I don't really understand the bug yet, but I wonder if there's a more elegant way to fix this. i.e. What is causing this condition |
I don't understand it either tbh, but I think I figured it out now with the latest commit. (Apologies for the not so wonderful commit names) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I LIKE THIS. 😄 (Indeed, a newline is a whitespace.)
Much better 👍 Thanks @matthewpi, good work! Appreciate your contribution.
This is an extremely weird edge-case where if you had a environment variable {}
on one line, a comment on the next line, and the closing of the block on the
following line; the rest of the Caddyfile would be indented further than it
should've been.
ref; caddyserver/vscode-caddyfile#13
A preview of what happens without this fix can be seen at https://streamable.com/ouziak
Formatting the file shown in the video worked fine before 635f075
Additional testing (or even a better way to handle this edge-case) would be appreciated.