Help with C++ autoformat


#1

Hello, I am trying to simply add C++ autoformat to Atom. I want it to be portable. I saw this post. It doesn’t seem like this method is portable. Does there exist a package that can simply be downloaded and will autoformat C++ with no need for any added Uncrustify or anything? I tried adding the Atom Beautify package but it said “Docker not found.” I tried following the directions and adding Docker but I could not find where, in Atom, the location of Docker was supposed to be written. Again, is there a package that can be downloaded and will autoformat C++ with no need for extra downloads? Thanks


#2

atom-beautify doesn’t require Docker. That’s a poorly written error. It does require downloading Uncrustify. Many Atom packages make use of outside software, and not all of those programs are available for download through the NPM system, like most things that aren’t pure JavaScript (which Uncrustify obviously is not). There’s no easy way for the package developer to automatically install it, and since Atom’s user base is mostly coders, the burden of installing packages from familiar platforms such as SourceForge is not enough of one for Atom to solve on an API level. So you’ll have to settle for downloading extra programs for tasks like this.

You can easily make it portable by explicitly setting the path to Uncrustify in the atom-beautify settings (Settings -> Packages -> atom-beautify -> Executables -> Uncrustify).


#3

Okay, I didn’t mention in the original post that I had already gotten just that far. I added the path and downloaded Uncrustify but it still said “Could not find ‘uncrustify’. The program may not be installed.” The Uncrustify folder looks like this:
uncrustify%20folder

I clicked copy as path and pasted it where you said to put it. In the box: E:\Uncrustify\uncrustify.exe.


#4

If there appears to be a bug in the package (it’s not running the appropriate file when you’ve provided the link), then the best place to bring that up is at the atom-beautify repo. I don’t use C++ or Uncrustify and don’t have any knowledge of the internals of atom-beautify, so I’m not in a position to help troubleshoot.