Development best practices

Howdy folks,
As I'm always tinkering with my development workflow, I was wondering how you have your dev setups?
Recently I switched from vim to vscode, and now I usually have 1-2 code files opened in vertical split view and 1, recently 2 terminal windows on the bottom. First I just recompiled on save/finishing a snipped, now I switched to cargo watch. But it's a real hassle to scroll up to every error, fixing it, saving and having to scroll back down since my terminal doesn't scroll with new input if I scrolled up. The in-code error highlights are too short for me. Is there a way to suppress all the unnecessary output from the compiler, only showing the errors, maybe 1-3 lines per error?
What's your workflow? Would be great if some of you could share their workflow, arrangement of windows and so on. Apologizes for this long text.
Have a nice weekend and thanks in advance,
Anton

Is there a way to suppress all the unnecessary output from the compiler, only showing the errors, maybe 1-3 lines per error?

Yes, but it's not easily accessible. --error-format short uses 1 line per error, but the option is unstable.

1 Like

I'm working almost entirely within Emacs, most of the time without a GUI (emacs -nw), deal with version control via magit, wrap some cargo calls via Makefiles, and therefore compile from within Emacs (M-x compile). During compilation all warnings and error messages are automatically gathered in a new split window, which can be searched (C-s) e.g. for errors, and you can jump directly to the source code (even if that file wasn't loaded before). I know it's kind of unusual workflow, but it works pretty well, e.g. rustfmt can be called within Emacs as well ...

My 2 cents :wink:

3 Likes

That's a good hint, thanks, I'll try that. One other option that came to my mind was building customized output on top of the json output, might try that as well :slight_smile:
Thanks so far :wink:

Since you're coming from vim: Do you know about the quickfix list? If you're using rust.vim and set compiler=cargo, you can just call make check and have the error populate the qf list and jump through them the usual way.

2 Likes

I just saw that there is an Emacs cargo minor mode as well:

1 Like

Oh that's nice, didn't know that, thanks :smiley: