Skip to content

Consider adding an option to allow indentation on empty lines or preserving indentation within blocks #151

@skison

Description

@skison

One feature the styleguide doesn't seem to directly touch on (only indirectly via examples) is the indentation of empty lines in combination with the "Draw Tabs" setting; this is a feature I find remarkably helpful for visually identifying related/scoped blocks of code while looking through the Godot editor. Without this feature as a formatting option, files can become harder to follow at a glance. Consider this example:

function with tabs on empty lines at multiple nested scopes, showing visual tab indicators on the left side

I'm able to trace through the different scopes of the code by glancing at the tab indicators on the left side. After formatting, it becomes:

function with no tabs on empty lines, leaving visually disconnected chunks of code within their scopes

And now the scopes are visually disconnected and don't read nicely.

Arguably this is more of an issue with the way the GDScript editor presents code, as other IDEs (e.g. VSCode) are capable of grouping up code regardless of the file's actual whitespace. Nonetheless it would be nice to have an option to retain the appropriate level of indentation for blank lines as a partial solution, at least until Godot supports a grouping feature natively.

It's worth mentioning that there is an Indent Guidelines addon for Godot 4.3/4.4 that may partially fix the problem, but that means having another project addon to manage, and I'm not sure if it works for 4.5 yet. I'd much prefer a solution that doesn't require tacking on another addon to the list!

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions