-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Value doc #625
base: main
Are you sure you want to change the base?
Conversation
I am also in favor or just returning the content without Rendering it. Maybe as a function on the C-abi. |
@@ -70,4 +70,10 @@ selectStringViews(nix::EvalState &State, nix::Value &V, | |||
return selectSymbols(State, V, toSymbols(State.symbols, AttrPath)); | |||
} | |||
|
|||
/// TODO: use https://github.com/NixOS/nix/pull/11914 on nix version bump | |||
/// \brief Get nix's `builtins` constant | |||
inline nix::Value &getBuiltins(const nix::EvalState &State) { |
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.
maybe remove, not used in this PR
@@ -31,6 +32,7 @@ constexpr inline std::string_view AttrPathInfo = "attrset/attrpathInfo"; | |||
constexpr inline std::string_view AttrPathComplete = "attrset/attrpathComplete"; | |||
constexpr inline std::string_view OptionInfo = "attrset/optionInfo"; | |||
constexpr inline std::string_view OptionComplete = "attrset/optionComplete"; | |||
|
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.
empty
|
||
std::optional<ValueDescription> describeValue(nix::EvalState &State, | ||
nix::Value &V) { | ||
const auto Doc = State.getDoc(V); |
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.
nix::EvalState::getDoc()
is invoked here
@@ -87,6 +87,10 @@ class NixpkgsHoverProvider { | |||
return OS.str(); | |||
} | |||
|
|||
static std::string mkValueMarkdown(const ValueDescription &ValueDesc) { | |||
return ValueDesc.Doc; |
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.
here, the documentation is replied directly without any formatting/tokenization.
This PR introduces
nix-repl
's:doc
command to nixd.Since NixOS/nix#11072, we can utilize the API exposed by
nix::EvalState::getDoc
. (i.e. to provide hover/completions(todo) from nixpkgs's doc comments).Current status:
:doc
command innix-repl
Also CC @roberth (author of nix implementation), @hsjobeki (author of doc-comments RFC). How can we co-operate to make these stuff more fancy? (It looks very ugly so far, 😆 )
I see there are some information for "definition" here, generally this information is separated from "hover-ed documentation" in LSP, can we have a new API to get a structured output?