Closed alexa-noxon closed 5 years ago
Which language are you trying to format, and what other extensions have you tried installing ? If you are doing C++ for example, Microsoft's C++ extension also provides formatting, so the code could simply be formatted using another tool than uncrustify.
Regarding the commands about presets, it's simply about saving configs in the extension's data. The "Uncrustify: Save config file as preset" command will save the config internally, and you can then load it using "Uncrustify: Load preset config file".
There must be a VSCode bug in the command search, because I also only see 4 commands when searching "uncrustify" even though there really are more than that (searching for "save config" or "open config" will show you the rest).
I am using C and I also have the C/C++ extension and the CMake extensions installed.
So you think that maybe that whatever formatting comes with the C/C++ extension is taking precedence over Uncrustify? Do you know if there is a way for me tell Visual Code to let Uncrustify overrule whatever other formatter it is using?
After searching for the other command you mentioned directly (instead of just searching Uncrustify) I am able to see it. Is there another way to trigger the Uncrustify action other than through the Format Document command which is possibly shared by other extensions?
Thanks for you help!
I just looked up, and there is a C_Cpp: Formatting
setting that can be set to Disabled
in VSCode's settings. With this option disabled, uncrustify
will be used instead of clang-format
to format the code.
This did the trick! Thank you for your help and for pointing me to that setting.
Hi,
I am new to using Visual Studio Code (this is one of my first times trying to install an extension) and am trying to use a previously existing Uncrustify config file with the Uncrustify extension. I have installed the Uncrustify plugin, and have set my Uncrustify plugin path in the settings
However, when I run the "FormatDocument" command, the code is formatted, but it does not seem like my .uncrustify.cfg file is being used to format the code.
Searching what Uncrustify commands are options for me, I see "Uncrustify: Delete preset config file" "Uncrustify: Load preset config file" "Uncrustify: Create default config file" "Uncrustify: Upgrade config file"
If I select "Create default config file" I can see that my uncrustify config gets overwritten, so I think that the setting path to my config file is taking.
I have seen in the read me that there should maybe also be an extension setting for "Open config file", but this is not appearing in my menu (are there other command options that I am missing?).
Do I need to "Load preset config file" before my config will be used? When I run "Load preset config file", an error X box appears and says "No presets saved"
Any help on what I might be missing in the configuration appreciated!
Thank you!