LaurentTreguier / vscode-uncrustify

Code format using uncrustify
66 stars 10 forks source link

Include Configuration in Installation Process #4

Closed rei-vilo closed 7 years ago

rei-vilo commented 7 years ago

Include Configuration in Installation Process, as per comment 2.

"uncrustify.executablePath": "uncrustify", 
"uncrustify.configPath": "/Users/<<UsernameNere>>/uncrustify.cfg", 
LaurentTreguier commented 7 years ago

What do you mean exactly ? The extension's automatic uncrustify installation includes some default config files.

rei-vilo commented 7 years ago

PREV: The instructions on how to setup this app are difficult to follow. Even with uncrustify working on the command line, I am unable to trigger the code reformatting.

"uncrustify.executablePath": "uncrustify", "uncrustify.configPath": "/Users/<>/uncrustify.cfg",

However, even after hitting ctrl+shift+f, there is no change to the file and no feedback that the app is working or even being called.

LaurentTreguier commented 7 years ago

That was the original comment, before the extension introduced automatic uncrustify installation... What is the problem exactly ? Is the extension not formatting anything ? Is it not recognizing the config file ? Is it about the location of the default config files ?

rei-vilo commented 7 years ago

Actually, four things:

  1. The installation process doesn't come with any default uncrustify.cfg.
  2. I had to search for uncrustify.configPath but found nothing.
  3. Then asked for the Open Settings and search again.
  4. Finally clicked on Edit, which generated the settings.json file where I could specify the path.

I would suggest automating step 4. for a faster configuration.

Once completed, everything ran smoothly.

LaurentTreguier commented 7 years ago

On what platform are you ? On Linux, uncrustify packages usually come with the default set of config files somewhere in /usr/share/. For example, for me on Fedora it's in /usr/share/doc/uncrustify/documentation/htdocs. On MacOS, the Homebrew package also installs config files (I don't know where exactly, but brew ls --verbose uncrustify should show them). On Windows, they should be in something like C:\Users\<USERNAME>\AppData\Roaming\MetaPkg\uncrustify\cfg. The uncrustify.configPath is simply part of VSCode's user configuration system. There is no need to automate the generation of a settings.json file in my opinion, you simply need to set it in the user settings and you should be good to go for all your projects.

rei-vilo commented 7 years ago

Thank you!