After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775521 - Automatically Reformat/Reindent Entire File
Automatically Reformat/Reindent Entire File
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: editor
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-12-02 14:18 UTC by Mike D. (Account disabled)
Modified: 2017-10-16 08:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike D. (Account disabled) 2016-12-02 14:18:14 UTC
Unfortunately, Gnome Builder does not let you reformat source code automatically to meet the requirements of your code style.

In IntelliJ IDEA you can automatically reformat an entire file by pressing CTRL+ALT+L.

As simple as that.

This is not possible with Gnome Builder (3.22.2).

Let's take a badly formatted .html file for example

```html
<!DOCTYPE html>
                <html>
    <head>
        <meta charset="utf-8"/>
                    <meta name="robots" content="noarchive"/>
                        </head>
        </html>
```

The only way seems to be to 1.) select line by line, and then 2.) press CTRL+ALT+l in each line. But I may be wrong. The Menu > Editor Shortcuts page describes the previously mentioned shortcut as "Reindent line", whatever this means. Could be everything or nothing.

But even this shortcut does not work, Pressing CTRL+ALT+l on a selected line does nothing at all. Even if you select all the code in the selected line, it simply does not work.

Basic features like automatic code indentation are missing. Frustrating!
Comment 1 sébastien lafargue 2016-12-02 14:20:07 UTC
There's a work in progress here:
https://git.gnome.org/browse/gnome-builder/?h=wip%2Fslaf%2Fbeautifier
Comment 2 sébastien lafargue 2016-12-02 14:25:54 UTC
Currently it only support Uncrustify, but clang-format and probably other beautifiers are coming soon.

After some more tests, i'll probably add a generic pattern command line format so that you can easily add your own command launcher, thing not possible with clang-format that want a .clang-format config file in the working dir or one of its parent.
Comment 3 Christian Hergert 2017-10-16 08:51:30 UTC
We also support this using language formatters (if present).

 * Ctrl+f in emacs
 * gq in vim

It looks like we're missing something for default mode.

I think rust is the only language providing an IdeFormatter right now though.