-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: move the repl input code to its own file #10083
Conversation
7d74a25
to
7abbeed
Compare
static constexpr const char * promptForType(ReplPromptType promptType) | ||
{ | ||
switch (promptType) { | ||
case ReplPromptType::ReplPrompt: | ||
return "nix-repl> "; | ||
case ReplPromptType::ContinuationPrompt: | ||
return " "; | ||
} | ||
assert(false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only actual new code in here
rl_set_complete_func(completionCallback); | ||
rl_set_list_possib_func(listPossibleCallback); | ||
#endif | ||
return restoreRepl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be a Finally in caller scope so we have to hoist it to the caller by returning it now. Nothing else is changed in this function.
|
7abbeed
to
faf8fec
Compare
|
Would be fixed by: #9546 |
Merged 🎉 |
e97087d
to
9c56a9c
Compare
free(vp[ac]); | ||
free(vp); | ||
} | ||
throw Error("allocation failure"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is probably a bad idea/unsound to unwind through libreadline, resulting in the terminal not being reset! But I'm not fixing it in this PR as this PR is just moving code around.
Merge conflicts fixed and it's expected to compile; this is now reviewable. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-03-04-nix-team-meeting-minute-130/40830/1 |
This is in direct preparation for an automation mode of nix repl.
9c56a9c
to
cc36428
Compare
Motivation
This is in preparation for #10075 which adds an automation mode to the repl that bypasses readline.
In order to make implementing that nice, I decided to do a refactoring to move all the repl input code into its own file and split it out of the repl proper. This keeps all the readline jank in one place and makes the repl more maintainable.
I split this into a separate PR to make it easier to review.
Context
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.