vscode-clang-format icon indicating copy to clipboard operation
vscode-clang-format copied to clipboard

Cannot format unsaved code

Open j-ulrich opened this issue 4 years ago • 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.

j-ulrich avatar Aug 26 '20 08:08 j-ulrich

Have you tried this to force the choice?

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

bdeeming avatar Aug 03 '21 02:08 bdeeming

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.

j-ulrich avatar Aug 09 '21 11:08 j-ulrich