cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
954 stars 105 forks source link

Unable to get the location of clang-format executable #244

Open MrModez opened 3 years ago

MrModez commented 3 years ago

While cmd utility works fine, VS Code integration doesn't work. This is the error I'm getting: image Why does it ask for clang-format? Anyway both cmake-format and clang-format are in my PATH.

cheshirekow commented 3 years ago

The "clang-format" text looks like an embarrassing typo. Sorry about that. The real issue is indicated by the remainder of the message "no workspaces available". Due to the way cmake-format configurations can be found on the filesystem, the vscode extension requires that the formatting be done within an active workspace (this could probably be relaxed in the future). I've never actually hit this error but my guess is that it might happen if you open a file with vscode directly from the command line? My suggestion is to open a directory with vscode so that it creates a workspace, and then open the listfile and try to format it.

cheshirekow commented 3 years ago

Did you resolve your issue by opening the file in a workspace?

deuxcents commented 3 years ago

Good evening, First, thank you for the plugin ! I had the same problem. If you open a directory and if the cmake file you open is whithin that directory then there is no error message. Please note that even if there is an error message, the file is still being formatted ! Having no error message (no check for workspace) would be fine i guess. Kind Regards

z0ow commented 3 years ago

Did you resolve your issue by opening the file in a workspace?

I am facing this problem too, and open the file in a workspace did solve it. 🤒