mirror of
https://github.com/NixOS/nix
synced 2024-09-19 23:03:53 -04:00
Revert "Use HintFmt for doc comments"
Unfortunately these don't render correctly, because they go into the markdown renderer, instead of the terminal. ``` nix-repl> :doc lib.version Attribute '[35;1mversion[0m' … defined at [35;1m/home/user/h/nixpkgs/lib/default.nix:73:40[0m ``` We could switch that to go direct to the terminal, but then we should do the same for the primops, to get a consistent look. Reverting for now. This reverts commit 3413e0338cbee1c7734d5cb614b5325e51815cde.
This commit is contained in:
parent
ce31a0457f
commit
03d33703ef
|
@ -668,12 +668,12 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
||||||
logger->cout(trim(renderMarkdownToTerminal(markdown)));
|
logger->cout(trim(renderMarkdownToTerminal(markdown)));
|
||||||
} else if (fallbackPos) {
|
} else if (fallbackPos) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << HintFmt("Attribute '%1%'", fallbackName) << "\n\n";
|
ss << "Attribute `" << fallbackName << "`\n\n";
|
||||||
ss << HintFmt(" … defined at %1%", state->positions[fallbackPos]) << "\n\n";
|
ss << " … defined at " << state->positions[fallbackPos] << "\n\n";
|
||||||
if (fallbackDoc) {
|
if (fallbackDoc) {
|
||||||
ss << fallbackDoc.getInnerText(state->positions);
|
ss << fallbackDoc.getInnerText(state->positions);
|
||||||
} else {
|
} else {
|
||||||
ss << HintFmt("No documentation found.") << "\n\n";
|
ss << "No documentation found.\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto markdown = ss.str();
|
auto markdown = ss.str();
|
||||||
|
|
|
@ -576,17 +576,17 @@ std::optional<EvalState::Doc> EvalState::getDoc(Value & v)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
s << HintFmt("Function ");
|
s << "Function ";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s << HintFmt("Function '%s'", name);
|
s << "Function `" << name << "`";
|
||||||
if (pos)
|
if (pos)
|
||||||
s << "\\\n … " ;
|
s << "\\\n … " ;
|
||||||
else
|
else
|
||||||
s << "\\\n";
|
s << "\\\n";
|
||||||
}
|
}
|
||||||
if (pos) {
|
if (pos) {
|
||||||
s << HintFmt("defined at %1%", pos);
|
s << "defined at " << pos;
|
||||||
}
|
}
|
||||||
if (!docStr.empty()) {
|
if (!docStr.empty()) {
|
||||||
s << "\n\n";
|
s << "\n\n";
|
||||||
|
|
Loading…
Reference in a new issue