Bug 470272 - Haskell indentation for “where“ seems broken
Summary: Haskell indentation for “where“ seems broken
Status: CONFIRMED
Alias: None
Product: kate
Classification: Applications
Component: indentation (other bugs)
Version First Reported In: 21.12.3
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-26 01:50 UTC by evi1m4chine+kde
Modified: 2024-10-20 18:34 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. :)