xaverh/vscode-clang-format

Cannot format unsaved code

j-ulrich opened this issue · 2 comments

If I try to format code which has not been saved to a file on disk yet, I get the message

There is no formatter for 'cpp' files installed.

I have the setting clang-format.assumeFilename configured and it works correctly as soon as the file is saved anywhere on disk.

It also doesn't matter if I have the setting C_Cpp.formatting disabled or set to "Default".

I'm running on macOS with zsh as the default shell, in case it matters.

Have you tried this to force the choice?

"[cpp]": {
    "editor.defaultFormatter": "xaver.clang-format"
  }

Have you tried this to force the choice?

"[cpp]": {
    "editor.defaultFormatter": "xaver.clang-format"
  }

Yes, this is set in my settings.json but the message still appears.