lydell/elm-watch

Use pager and scroll to top in hot mode

nidico opened this issue · 3 comments

In my experience it makes sense to work through compiler errors from top to bottom. If the errors messages don't fit, one has to scroll up after running elm make / elm-watch make / elm-watch hot in order to see the first message which is the one I want to work on typically.

Automatically scrolling up to the first error requires some sort of pager mode which makes most sense in hot mode, as it is a running process already and not just "output once".

I'd suggest to put the summary (x errors found etc) on top of the compiler errors and show the output in some sort of (less style) pager, scrolled to top by default. In addition to allowing "scroll-to-top", a pager has the advantage that it allows scrolling (page and linewise) with single keystrokes compared to built-in scrolling in many terminal emulators which require e.g. ctrl-pageup or shift-pageup.

Of course this feature could be made optional through a -P flag, but I think it makes sense to default to this behavior.

Hi!

Which terminal on which OS do you use?

I’ve tried Terminal and iTerm2 on macOS, and they “remember” my scroll position. So if I scroll to the top of the errors once and then cause a recompilation, it stays at the top (until “next time” so one has to scroll to the top every now and then). You won’t see the “x errors found” of course, but it’s something.

As I mention in https://lydell.github.io/elm-watch/what-elm-watch-is/#ideas-for-the-future, I have an idea to make errors more “interactive” in the future. I’ll keep this in mind then! However, I don’t know when I’ll work on it.

You might also be interested in that the next version of elm-watch (currently available as npm install elm-watch@beta) you can opt in to an error overlay in the browser, which does start scrolled to the top. Still not exactly what you’re asking for, but anyway.

Thanks for the prompt reply!

I’ve tried Terminal and iTerm2 on macOS, and they “remember” my scroll position.

Very interesting! Both foot on Debian Linux and urxvt don't remember the scroll position, maybe they could be configured differently. Interestingly, Konsole does remember the scroll position; gnome-terminal and xfce4-terminal don't.

I'll investigate the terminal scroll behavior further at another time!

As I mention in https://lydell.github.io/elm-watch/what-elm-watch-is/#ideas-for-the-future, I have an idea to make errors more “interactive” in the future.

Cool. I'd envision being able to navigate through the errors somehow and be able to send a custom command to an external editor in order to make it jump to the error position...

You might also be interested in that the next version of elm-watch (currently available as npm install elm-watch@beta) you can opt in to an error overlay in the browser, which does start scrolled to the top. Still not exactly what you’re asking for, but anyway.

Yeah, I read that and I'm curious to try it out, but haven't done so yet (despite using @beta already). In the end I'm quite a bit of a terminal guy, but having the errors in the browser can still be useful!

By the way, as we're in a bug tracker which focuses on improvements of certain aspects, I didn't have the chance to say that elm-watch is one awesome tool (I'd say "the best web dev support tool" I encountered so far)! Thank you very much for your work!!

I'd envision being able to navigate through the errors somehow and be able to send a custom command to an external editor in order to make it jump to the error position

That sounds amazing! 👍