handle
handle

Reputation: 6299

Indent settings for atom-beautify with uncrustify for C/C++?

Where can the indent settings (tab width) be set for uncrustify run by the Atom package atom-beautify (on Windows)? While the package settings offer to specify a path for an uncrustify config file (separately for C and C++), I can't figure out where the default settings come from.

Upvotes: 2

Views: 3118

Answers (2)

ungalcrys
ungalcrys

Reputation: 5610

go to Atom's top menu bar -> Packages -> Atom Beautify -> Settings and open the C section as in the picture below:

enter image description here

there you must fill the Config Path with yours, mine, because I work on Ubuntu, was:

/home/ungalcrys/.atom/packages/atom-beautify/src/beautifiers/uncrustify/default.cfg

on Windows it migt be:

C:\Users\ungalcrys\.atom\packages\atom-beautify\src\beautifiers\uncrustify\default.cfg

default.cfg file already exists and you may have to comment one or two lines depending on the version of uncrustify.

Upvotes: 0

handle
handle

Reputation: 6299

The package directory is

  • Windows: C:\Users\<user>\.atom\packages\atom-beautify\src\beautifiers\uncrustify

Uncrustify is run via index.coffee, resulting in arguments like:

C:\uncrustify\uncrustify.exe
-c
C:\Users\<user>\AppData\Local\Temp\.....cfg
-f
C:\Users\<user>\AppData\Local\Temp\input...
-o
C:\Users\<user>\AppData\Local\Temp\output...
-l
CPP

If no path is configured in settings, it generates a temporary config via cfg.coffee. It may just look like

indent_with_tabs = 0
output_tab_size = 2
input_tab_size = 2

This may not be enough for uncrustify to modify the source as intended. I am not sure from where these settings originate (Atom Editor Settings?). So I just modified default.cfg in the package directory (reduce tab width to 4, spaces for tabs -- not sure which parameter did it), added that to the settings, et voila...

Upvotes: 1

Related Questions