Skip to content
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

Improve the way mix is invoked in concurrent VSCode environment #7

Closed
wants to merge 3 commits into from

Conversation

frantic
Copy link

@frantic frantic commented Mar 25, 2020

Looks like there was a change in how VSCode works.

In the past this extension used to call document.save() before invoking mix format. The format 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 for document.save(). VSCode shows infinite spinner dialog.

This PR fixes the behavior. I switched exec with spawn 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 and formatterCwd options are still working and I documented the new mixCommandPath.

@frantic frantic changed the title Improve the way mix invoked in concurrent VSCode environment Improve the way mix is invoked in concurrent VSCode environment Mar 25, 2020
@bitboxer
Copy link

@sarat-ravi is this still maintained? Would love to see this merged and would offer any help you need for this.

@psylone
Copy link

psylone commented Jul 18, 2020

Now VSCode invokes the extension before it saves the file, and document.save() waits for this extension to finish, but the extension is waiting for document.save(). VSCode shows infinite spinner dialog.

I wonder, whether this bug occurs always or in case when Format On Save option enabled?

@frantic frantic closed this Apr 23, 2021
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.

Does not work with elixir installed via kiex
4 participants