Fire not indenting correctly

I’ve noticed that Fire is not indenting properly, sometimes…

Here’s a GIF in a C# class file:

2023-04-01 11.48.37

I think this is a bug?

Hmm, this behaves as i’d expect here, whether the closing brace is auto-inserted or (I ad expect maybe that want handled well, but it was): already present:

what could I be missing?

Oh wait,this happens when you press enter ON the line that has only the closing }. I gotta admit that’s a bit unexpected and I’m not sure why this is happening, but I’m, not sure it’s necessarily wrong, it tries to align the } with the next outer block.

I’ll review if i can improve this special case — i assume ideally you’d want the a new line inserted, but keep the cursor ON the new line to type the method body (although that’s not really what enter does :upside_down_face:).

I see two potential improvements here>
(a) fix as described above, but more importantly
(b) for enter within {|} to add TWO lines, so yu;d end up in the same scenario you would if the closing } had n ot been present.

(but really, why would you type the '}'and then move the cursor back and press enter, when you could just press enter ;).

First scenario is fixed. Enter within {} now adds two linebreaks and appropriately positions the cursor indented in the middle line.

As a nice side effect, fixing this issue finally let me to a repro for a very rare and long-standing undo issue (unrelated to this) where after pressing enter in very specific scenarios Undo would break. This too is now fixed.

I’m not sure if I want to fix part (a) from above, or of that is still necesary.

I’ve uploaded a new build with this fix and the one form the other thread, to Personal Downloads for you.

Thanks - I’ll report back if it’s sorted.

It works. Great job, thank you.

1 Like

You agree the other part (a) does not need changing?

Yep, it’s cool.

1 Like