Bug 470272

Summary: Haskell indentation for “where“ seems broken
Product: [Applications] kate Reporter: evi1m4chine+kde
Component: indentationAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 21.12.3   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description evi1m4chine+kde 2023-05-26 01:50:56 UTC
SUMMARY

When using the `where` clause in a new line at the end of functions, it gets automatically unindented out of the context of the function.

STEPS TO REPRODUCE

1. Create a new file, set the mode to “Haskell”, and enter the following code:

someaction = do
  let someLoopingFunction = someLoopingFunction' $
        someComplexInitialState
  someLoopingFunction

2. Now place the cursor at the end of “State”, press enter, and type `where `, including the space, as you would do to then define `someLoopingFunction'`.

OBSERVED RESULT
When pressing space, `where` immediately jumps to the same indentation level as `let` (2 spaces in this case).

EXPECTED RESULT
It should have stayed inside the context of `someLoopingFunction`. So at the level of `someComplexInitialState` or deeper if the user pressed TAB first.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Mint 21.1 Cinnamon (Ubuntu 22.04 LTS)
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION

Generally indentation for `where` seems broken, as it causes so much trouble that I am forced to disable automatic indentation completely, as it always tries to act like it knows better and breaks everything. Since I haven’t yet seen the general logic behind its behavior, I am unable to report if there is a more general problem, and will only report the case I found right now. If/when I find other variations or a more general pattern, I will report it when I can reproduce it.

Note that I cannot update Kate or KDE, as this is the current version available for Ubuntu LTS and hence Mint until Mint 22 comes out. (If there is a PPA available, I will take it. :)