-
Notifications
You must be signed in to change notification settings - Fork 2
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
Black edits being deferred by Nova during save operations #1
Comments
Thanks for creating an issue for this. It's always a pleasure to hear that people are using things I make. Blake shells out to a Black process within an
Blake does alter the document using an There's no mention of how long is "too long", but I think the process of running Black within a shell is taking too long to return, and so the edits are being deferred. I'll have to rethink how I'm running Flake8 and Black on save, perhaps try and run them synchronously one after the other, using Black's output as input to Flake8. |
And thanks for creating this... I've tried to make the black round-trip faster, by using blackd and just POST'ing a request, but this is still not fast enough. To implement a true "format before save" option, we need to have a way in nova's API to defer save until all edits are done. I've asked Panic support about this. |
I don't think it's the time it takes to run black. From the Nova docs for
Black is definitely not taking that long! 😅 The problem is that
Right now, the I've been understanding this through an extension I'm working on and I'd be happy to take a crack at making it work here. However, playing around with the code a little, I believe it will be a significant refactor of at least |
I ended up making these changes in #4. Even if they don't get merged, we can at least see what it might look like. |
Blake process is asynchronous, and acts on the editor's buffer, but nova will save the file before Blake's actions.
You see the file after Blake's edit, but the file saved is the previous version.
This led to strange flake reports on formatting issues, as flake8 will read the saved file, but report it on the version corrected by Blake, which is correct.
I didn't find any way to tell nova to wait for the end of edit before saving, so I don't know if it can work correctly with the current nova API.
The text was updated successfully, but these errors were encountered: