Skip to content

use case: zig build on the command line without having to scroll up to find the compile errors #6673

@andrewrk

Description

@andrewrk

It's not apparent yet because some of this stuff is not yet implemented but there are multiple consumers of the zig build system. The programmer using a terminal is the main use case for now, but there is also IDEs, language servers, package manager, as well as other terminal based usages such as troubleshooting the build, visualizing it, and the --help menu.

Sometimes a zig build invocation can end up printing long error traces with "command failed" being printed after compile errors, forcing the user to have to scroll up. This is not an ideal experience. It is important for this troubleshooting information to be printed by default, however, it should be possible to get into a workflow where only the thing you care about is printed, which is often compile errors.

It's not super simple to solve this because compile errors could come from multiple different invocations of the zig compiler, or even from compiling C or C++ code. Furthermore, compile error messages from zig contain extra metadata that can't be communicated in the terminal. For example they are actually in a tree form, with error notes being attached to parent errors. Zig also has no error limit of how many to print, because the idea is that they would be collected by some kind of IDE and displayed inline with source code, in addition to a global list.

However, the use case of not using an IDE is also valid and so this issue is open to track progress on that front. I don't think --quiet adequately captures the intent here, which is to specifically focus compile errors - not to silence all output. It's possible we will see --watch turn into something that addresses this use case.

I also don't think reversing the traceback is appropriate. Status quo is the natural stack order; nothing needs to be buffered, and the beginning and ends of stack traces connect correctly to the error messages on either end - including with error return traces. Buffering and reversing the traceback is not a sufficient solution as well as introduces new drawbacks.

This issue is not yet a concrete proposal because I'd like to focus on the zig build system and the package manager (#943) together, but my main focus right now is the self-hosted compiler (#89). Suffice to say, this use case will be solved in a satisfying way eventually, but it's unclear exactly how yet. This is something I expect to be addressed in the 0.9.0 release cycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions