idris-hackers / idris-mode

Idris syntax highlighting, compiler-supported editing, interactive REPL and more things for Emacs.
GNU General Public License v3.0
267 stars 70 forks source link

Add `idris-format` module with `idris-format-align-lhs` command #615

Open keram opened 1 year ago

keram commented 1 year ago

Why: Sometimes it makes nicer to align left hand side to columns.

Demo:

output-2023-02-02-19:16:59

output-2023-02-02-19:19:45

This is first version and as next step it could be nice generalise the solution for aligning different types left hands sides. Also not sure if this should live in idris-mode or rather as separate package 🤔

jfdm commented 1 year ago

...live in idris-mode or rather as separate package...

This is more an open discussion rather than a strict 'we must do'...

@keram I have been having a think about idris-format, specifically if this is something that is idris specific or something that is applicable to more languages.

One could even argue, and perhaps a more long term solution, is for code formatting to be part of the Idris2 compiler's operation and communicated through the IDE-Protocol.

More so updating Idris1 is not a priority, and having the idris-format package available until Idris1 is truly deprecated would be beneficial.

So perhaps these points are something to bear in mind.