Search code examples
cvisual-studio-codeformattingclang

Clang-format "not available" in VSCode, despite being in /usr/bin


It seems like a simple to solve issue, but I am on and off for several days and cannot make it work. I checked google and here and followed all instructions, but still no success. Here is the problem: I want to run clang-format on save of my file in VSCode. I installed the Clang-format extension as well as clang-format and clang-format-11 itself. Clang formatting works in the console, the bin is in /usr/bin. However, I setup the vscode extension and know it should work, because I get the error "The '/usr/bin/clang-format-11' is not available". I was like, it should be there, but if I ls /usr/bin inside the VSCode console, it is actually missing. I tried trouble shooting by using the external console and adding the bashrc to vscode using

"terminal.integrated.shellArgs.linux": ["-l"]

but it still doesn't work. Does anyone have any more ideas what I am missing?


Solution

  • I figured after some lengthy research that all files in root belonged to nfsnobody and not me/root. Turned out I installed it from flatpack and didn't pay attention, so basically I was in a sandbox all the time. Maybe it helps someone else.