Improve the way mix is invoked in concurrent VSCode environment #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looks like there was a change in how VSCode works.
In the past this extension used to call
document.save()
before invokingmix format
. Theformat
function simply operated on saved file.Now VSCode invokes the extension before it saves the file, and
document.save()
waits for this extension to finish, but the extension is waiting fordocument.save()
. VSCode shows infinite spinner dialog.This PR fixes the behavior. I switched
exec
withspawn
and use stdio to send the unformatted and receive the formatted file. I've also improved the error message so it should be easier to figure out what's not working.Because I had to make some substantial changes, I also backported #6 by @maennchen (which fixes #5). #4 should be fixed too because
spawn
accepts arguments as array of strings and does the escaping for us.I've tried my best to do some reasonable testing.
mixFormatArgs
andformatterCwd
options are still working and I documented the newmixCommandPath
.