Skip to content

fix(mbake): correct mbake command and use stdin#798

Merged
stevearc merged 4 commits intostevearc:masterfrom
Saul-CD:fix-mbake
Nov 3, 2025
Merged

fix(mbake): correct mbake command and use stdin#798
stevearc merged 4 commits intostevearc:masterfrom
Saul-CD:fix-mbake

Conversation

@Saul-CD
Copy link
Contributor

@Saul-CD Saul-CD commented Nov 2, 2025

I noticed that the existing bake formatter was not working correctly after installing it with mason.nvim, and after some investigation, I found two main issues and fixed them in a new file mbake.lua.

I chose to create a new mbake.lua file and set its command = "mbake" instead of modifying the existing bake.lua because thats the name it has in pypi, mason, and its the current default (and i think only) name of the executable: EbodShojaei/bake@f4b1c9f EbodShojaei/bake@e60dec1
Having a formatter named mbake will be more intuitive i think.

Also, the previous approach (stdin = false and passing $FILENAME as an argument) caused the formatter to fail: mbake would correctly format the temporary file created by conform.nvim, but since it formats the file in-place, it doesn't return any output to stdout, which was interpreted as a failure and the (correctly formatted) temporary file was deleted, leaving the original buffer untouched.
This fix uses the --stdin flag, which was specifically added to mbake for editor integrations like this one. EbodShojaei/bake@0cd0cbd

Finally, I'd like to mention that this is my first pull request to an open-source project. I'm incredibly excited to contribute, but I'm also aware that I might not have followed all the project's conventions perfectly.
I am completely open to any feedback, suggestions, or requested changes. Please let me know if there's anything I can do to improve this PR or future contributions!

@github-actions github-actions bot requested a review from stevearc November 2, 2025 03:24
Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I just merged #796 which makes the same change from bake -> mbake, but I'm happy to take a change to use stdin/stdout as well. I'd prefer to keep this in the same formatter rather than creating two. Could you merge your changes into the existing bake formatter?

@github-actions github-actions bot requested a review from stevearc November 3, 2025 02:24
@stevearc
Copy link
Owner

stevearc commented Nov 3, 2025

LGTM thanks!

@Saul-CD
Copy link
Contributor Author

Saul-CD commented Nov 3, 2025

Thanks so much for the feedback and for taking the time to review my PR.

I'm happy to make that change. I updated my branch
Thanks again for the guidance!

@stevearc stevearc merged commit 26c02e1 into stevearc:master Nov 3, 2025
9 checks passed
@Saul-CD Saul-CD deleted the fix-mbake branch November 3, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants