pragmagic/vscode-nim

Format on save "No 'nimpretty' binary could be found in PATH environment variable

Closed this issue · 7 comments

Thanks for this wonderful extension!

I am facing an issue that appeared recently (perhaps after an update), however. Whenever I save my file, I get the message No 'nimpretty' binary could be found in PATH environment variable. I am not even sure what nimpretty is exactly or why I am getting this error. I installed nim through choosenim installation, and have the latest version of the VSCode plugin. My nim path is set appropriately in /.bashrc as well. Does anyone know how to fix this issue?

nimpretty is its own executable for auto formatting. Do you have it in your PATH? If not, you might need to switch to devel channel on choosenim to install it. Also, VSCode itself doesn't load ~/.bashrc on startup (even though the terminal inside will), there are two workarounds:

  • Start VSCode from the your OS's terminal by calling code path/to/project
  • State your export PATH="directory/of/nimpretty:$PATH" in your ~/.profile` instead

@p-adams formatting in the extension uses nimpretty that not available in the current release version of Nim. You can disable "Format On Save" in settings.json to avoid getting this error message:

"editor.formatOnSave": false

@kosz78 I did this in VSCode user settings so that disabling it does not impact formatOnSave for other file types I typically work with:

"[nim]": {
    "editor.formatOnSave": false
  }

cd into your nim directory and then build tools.
bin directory created add into PATH.

cd ~/.choosenim/toolchains/<VERSION>
./koch tools

you should find ./bin

girng commented

I'm getting this error as well. I can't find the nimpretty executable. I downloaded the zip from https://nim-lang.org/install_windows.html. It's not in the /bin folder :(

azlan commented

I'm getting this error as well. I can't find the nimpretty executable. I downloaded the zip from https://nim-lang.org/install_windows.html. It's not in the /bin folder :(

You can compile it by yourself, it in \nim-1.0.0\nimpretty\ directory
However, the extension failed to execute it, even after I put the folder into %PATH%

girng commented

I'm getting this error as well. I can't find the nimpretty executable. I downloaded the zip from https://nim-lang.org/install_windows.html. It's not in the /bin folder :(

You can compile it by yourself, it in \nim-1.0.0\nimpretty\ directory
However, the extension failed to execute it, even after I put the folder into %PATH%

Hmm, yeah. Same here. I don't know what to do. A moderator on the forum said something will be fixed next week or so