forked from lix-project/lix
Merge pull request #9919 from 9999years/reduce-debugger-clutter
Reduce visual clutter in the debugger
This commit is contained in:
commit
f388a6148d
37
doc/manual/rl-next/reduce-debugger-clutter.md
Normal file
37
doc/manual/rl-next/reduce-debugger-clutter.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
synopsis: "Visual clutter in `--debugger` is reduced"
|
||||||
|
prs: 9919
|
||||||
|
---
|
||||||
|
|
||||||
|
Before:
|
||||||
|
```
|
||||||
|
info: breakpoint reached
|
||||||
|
|
||||||
|
|
||||||
|
Starting REPL to allow you to inspect the current state of the evaluator.
|
||||||
|
|
||||||
|
Welcome to Nix 2.20.0pre20231222_dirty. Type :? for help.
|
||||||
|
|
||||||
|
nix-repl> :continue
|
||||||
|
error: uh oh
|
||||||
|
|
||||||
|
|
||||||
|
Starting REPL to allow you to inspect the current state of the evaluator.
|
||||||
|
|
||||||
|
Welcome to Nix 2.20.0pre20231222_dirty. Type :? for help.
|
||||||
|
|
||||||
|
nix-repl>
|
||||||
|
```
|
||||||
|
|
||||||
|
After:
|
||||||
|
|
||||||
|
```
|
||||||
|
info: breakpoint reached
|
||||||
|
|
||||||
|
Nix 2.20.0pre20231222_dirty debugger
|
||||||
|
Type :? for help.
|
||||||
|
nix-repl> :continue
|
||||||
|
error: uh oh
|
||||||
|
|
||||||
|
nix-repl>
|
||||||
|
```
|
|
@ -243,10 +243,19 @@ static std::ostream & showDebugTrace(std::ostream & out, const PosTable & positi
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isFirstRepl = true;
|
||||||
|
|
||||||
void NixRepl::mainLoop()
|
void NixRepl::mainLoop()
|
||||||
{
|
{
|
||||||
std::string error = ANSI_RED "error:" ANSI_NORMAL " ";
|
if (isFirstRepl) {
|
||||||
notice("Welcome to Nix " + nixVersion + ". Type :? for help.\n");
|
std::string_view debuggerNotice = "";
|
||||||
|
if (state->debugRepl) {
|
||||||
|
debuggerNotice = " debugger";
|
||||||
|
}
|
||||||
|
notice("Nix %1%%2%\nType :? for help.", nixVersion, debuggerNotice);
|
||||||
|
}
|
||||||
|
|
||||||
|
isFirstRepl = false;
|
||||||
|
|
||||||
loadFiles();
|
loadFiles();
|
||||||
|
|
||||||
|
|
|
@ -821,12 +821,10 @@ void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr &
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
printError("%s\n\n", error->what());
|
printError("%s\n", error->what());
|
||||||
|
|
||||||
if (trylevel > 0 && error->info().level != lvlInfo)
|
if (trylevel > 0 && error->info().level != lvlInfo)
|
||||||
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL " to skip these.\n");
|
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL " to skip these.\n");
|
||||||
|
|
||||||
printError(ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto se = getStaticEnv(expr);
|
auto se = getStaticEnv(expr);
|
||||||
|
|
Loading…
Reference in a new issue