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

v0.1.0 does not work "Error: spawnSync undefined ENOENT" #2

Open
wyouflf opened this issue Mar 21, 2016 · 15 comments
Open

v0.1.0 does not work "Error: spawnSync undefined ENOENT" #2

wyouflf opened this issue Mar 21, 2016 · 15 comments

Comments

@wyouflf
Copy link

wyouflf commented Mar 21, 2016

run "Format with rustfmt"
tips:
"Error: spawnSync undefined ENOENT"

@Steve-Himself
Copy link

The Rusty Code extension has formatting and language support build in. Can also optionally turn on format on save and check on save

    "rust.formatOnSave": true,
    "rust.checkOnSave": true

@masaeedu
Copy link

masaeedu commented Oct 5, 2016

@Steve-Himself I'm using that extension, but it doesn't seem like hitting Alt+Shift+F or running "Format Code" from the command palette does anything. Works perfectly when I run rustfmt <path/to/file> from the command line though.

@lnicola
Copy link

lnicola commented Oct 5, 2016

@masaeedu are you on Windows? It never worked for me, but it's fine on Linux.

@masaeedu
Copy link

masaeedu commented Oct 5, 2016

@lnicola Yes. It looks like there was an incompatibility introduced in a PR with the latest version of rustfmt, other people have brought this up at saviorisdead/RustyCode#172, pending PR to fix is at saviorisdead/RustyCode#173.

@kkimdev
Copy link

kkimdev commented Nov 10, 2016

Hi, looks like saviorisdead/RustyCode#173 was merged. What's the status of this issue?

@lnicola
Copy link

lnicola commented Nov 11, 2016

@kkimdev works for me

@darklajid
Copy link

Is there a way to see what this is trying to spawn? A log with actual values for the spawn/fork call? I just ran into the same issue, on Arch Linux. rustfmt is availabe (0.6.3 atm, available on the path), but I see that very same spawnSync error message.

rustfmt works if I launch it manually and - as stated before - is available everywhere/on the path..

@anothermindbomb
Copy link

Same issue with me here on Windows 10 using VS Code. I'm trying to learn rust, so I thought I'd make myself a nice environment to play in, using rustycode, rustfmt, rustsym and so forth. Got pretty much everything working within VS Code except for the constant error message telling me "Error: spawnSync undefined ENOENT" every time I edit a line or save a file.

Because simply pressing enter to add a blank line generates this, I suspected rustfmt not being configured correctly, but because I can find no log for VS code telling me what the hell it's trying to spawn/open I'm a bit stuck.

Visual Studio Code

Version 1.8.1
Commit ee428b0eead68bf0fb99ab5fdc4439be227b6281
Date 2016-12-19T14:49:23.350Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0

P:\Projects\rust\fizzbuzz\src>racer --version
racer 2.0.2

P:\Projects\rust\fizzbuzz\src>rustfmt --version
0.6.3 ()

P:\Projects\rust\fizzbuzz\src>rustsym --version
rustsym 0.3.1

P:\Projects\rust\fizzbuzz\src>cargo --version
cargo 0.13.0-nightly (eca9e15 2016-11-01)

P:\Projects\rust\fizzbuzz\src>rustc --version
rustc 1.13.0 (2c6933acc 2016-11-07)

Is it actually possible to encourage VS Code to produce a log, or to view the logging produced by an extension?

@itarato
Copy link

itarato commented Jan 10, 2017

I've found that in some cases the default config for rustfmt.bin is not there in vscode and the plugin only uses the default rustfmt bin if the config is an empty string - however being undefined it's not handled and the spawn will get an empty path (hence the ENOENT).

This pull request is fixing that scenario: #3

Update: forgot to mention, putting "rustfmt.bin": "<your rustfmt path>" into vscode settings.json is equally a good solution.

@alessio-b-zak
Copy link

@itarato I've tried to add the path to my settings file but the only setting to change is "rust.rustfmtPath": null , I've tried adding the path but even then it doesn't work. Do you add the extra setting?

@itarato
Copy link

itarato commented Feb 24, 2017

@alessio-b-zak If I remember correctly the setting key (rustfmt.bin) wasn't exposed for me, however it is there: https://github.com/Connorcpu/vsc-rustfmt/blob/master/package.json#L35 For clarity - this was on Windows 10. Not sure where did you get "rust.rustfmtPath", did you try rustfmt.bin too? Also, you can try applying the patch: #3

@alessio-b-zak
Copy link

@itarato found it in the global settings.json you can edit from edit->preferences or something like that. Will try your fix out. Thanks.

@malcolmgreaves
Copy link

I uninstalled vsc-rustfmt, which completely removes the error. I am using the RustyCode plugin, which replaces all of the functionality of this plugin. Additionally, it adds greater support for even more rust tools e.g. racer, rustsym, and cargo.

@abhi18av
Copy link

abhi18av commented Jun 9, 2017

@malcolmgreaves this sure worked for me!

@bsed
Copy link

bsed commented Jun 11, 2017

tks, i have remove vsc-rustfmt plugin

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

No branches or pull requests