Sublime Forum

Bracket indenting issue

#1

I do a lot of C++ and Rust programming and I’m having an issue when closing brackets.

fn foo() {
    let x = 5;
}

fn bar() {
    let x = 5;
    } // This should automatically dedent.

This happens fairly often and not just with functions but with structs, classes, branching statements, etc.

0 Likes

#2

I just tried typing your example and it works for me, it automatically unindents the } as soon as I type it.

0 Likes

#3

It mostly happens when there’s no code inbetween the braces:

0 Likes

#4

This is due to how the indentation engine works:

0 Likes

#5

It still happens with whitespace between the braces:

1 Like

#6

I see what you mean. This looks like a core ST bug to me. Doing a Selection -> Select All, Edit -> Line -> Reindent seems to work as expected, so it is only a problem while typing.

0 Likes

#7

This problem has been pretty annoying for me, but hopefully the Reindent command can make it slightly less annoying.

Do you know where I could report this bug?

0 Likes

#8

The ST devs have been pretty good at monitoring https://github.com/SublimeTextIssues/Core/issues recently.

0 Likes

#9

Thanks, I’ll post it there.

0 Likes