vscode-proto3 icon indicating copy to clipboard operation
vscode-proto3 copied to clipboard

spawnSync clang-format ENOENT

Open aixelent opened this issue 6 years ago • 9 comments

Hello.

I installed your great extension. However always when i use Ctrl + Shift + I I get this error: spawnSync clang-format ENOENT

OS: Linux Mint 19.1 VSCode 1.32.1 (Latest version)

aixelent avatar Mar 14 '19 19:03 aixelent

Hi, you need to have clang-format in you path

zxh0 avatar Mar 15 '19 01:03 zxh0

@zxh0 would it be possible to add a config setting to specify the clang-format path? That is how other extensions usually solve this issue :)

aforster avatar Apr 18 '19 07:04 aforster

macos: brew install clang-format linux: sudo apt install clang-format

sunwgit avatar May 06 '19 07:05 sunwgit

I have the following config:

{
  "protoc": {
    "path": "/usr/bin/clang-format-6.0"
  }
}

but it still gives the same error. I don't see anything in the logs.

gracenoah avatar May 14 '19 12:05 gracenoah

@gracenoah This path config for protoc isn't going to work. The extension tries to call clang-format on save (if you have "format on save" enabled). You can create a symbolic link since your clang-format binary is not strictly clang-format but clang-format-6.0:

ln -s /usr/bin/clang-format-6.0 /usr/bin/clang-format

gabstv avatar May 16 '19 19:05 gabstv

https://marketplace.visualstudio.com/items?itemName=xaver.clang-format

This extension will attempt to find clang-format on your PATH. Alternatively, the clang-format executable can be specified in your vscode settings.json file:

{
    "clang-format.executable": "/absolute/path/to/clang-format"
}

jpreese avatar Jun 18 '19 17:06 jpreese

Is there a way to disable formatting, because there is no way of setting the tab size via settings.json.

Or you can add the ability to set the tab size via the clang-format option like you did with the style option, e.g. "clang-format.indentWidth": 4 or "clang-format.tabSize": 4

Techassi avatar Mar 14 '20 16:03 Techassi

Add this line into settings.json ?

 "editor.formatOnSave": false,

zxh0 avatar Mar 15 '20 00:03 zxh0

@Techassi you can have a look at this https://github.com/zxh0/vscode-proto3/issues/79 , you are able to tune the settings directly from vscode

Tommy-42 avatar May 18 '20 12:05 Tommy-42