I started going through some of the tutorial using "roc repl" and I'm curious if the repl is planning on having automatic indentation when creating functions. Example below
» test = \a -> (press enter after the ->)
… a (press enter - doesn't auto indent) -- compiler sad (error)
» test = \a -> (press enter after the ->)
… a (press space, press enter) -- compiler happy
That is a great question and I think it would be a great idea to support. My suspicion is that it wouldn't even be too hard to implement with the current design of the roc parser+repl.
I created an issue for this here https://github.com/roc-lang/roc/issues/5101
For anyone interested I think the relevant JS is in www/build/repl/repl.js
That is probably just the web repl. Should be different rust code for the cli repl as well
The repl.js file prints out each string from Rust exactly as it is, preformatted, into a HTML pre
tag. All of the formatting and indentation code is in Rust.
This is to share as much as possible and keep things consistent
I was looking into the possibility of auto indent but it seems RustyLine doesn't support it. https://github.com/kkawakam/rustyline/issues/453
https://github.com/kkawakam/rustyline/pull/466
Any ideas?
Last updated: Jul 06 2025 at 12:14 UTC