cmake_format icon indicating copy to clipboard operation
cmake_format copied to clipboard

Windows installation procedure for VSCode

Open RomanKhv opened this issue 2 years ago • 2 comments

Hi! Could you please git it working for me?

  1. I've install Python latest version,
  2. in VSCode i've installed cmake-format extension
  3. should I do something more?..

In VSCode I open CMakeLists.txt, select "Format Document" command - nothing happens :(

Thank you in advance

RomanKhv avatar Sep 22 '22 09:09 RomanKhv

If you still haven't gotten this working, you may want to do the following:

  1. Open the command palette (Ctrl+Shift+P)
  2. Type 'sett' and select "Preferences: Open User Settings (JSON)"
  3. Add exePath and args to the existing JSON; see below for an example
  4. Save the changed JSON file and close the document

At this point, you should be able to invoke the "Format Document" command, as you noted above and should see you CMakeLists.txt file change.

Note, to get the format file, with settings, you have to export it from cmake-format.exe and make changes as required: cmake-format.exe --dump-config python > sample-settings.py

Hope this helps.

Example JSON settings:

{
    "editor.fontFamily": "MesloLGM Nerd Font Mono",
    [...]
    "cmakeFormat.exePath": "C:\\FillInYourPythonPath\\Scripts\\cmake-format.exe",
    "cmakeFormat.args": ["--config-file", "C:\\FillInYourPreferredDocPath\\my_cmake_format.py"]
}

AhiyaHiya avatar Mar 09 '23 23:03 AhiyaHiya

See my latest comment on #242 Hope it helps :)

Michael-Liao avatar Apr 27 '23 14:04 Michael-Liao