-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repl: improve
:doc
builtin repl command to support lambdas.
For a long time `nix repl` has supported displaying documentation set on builtins, however, it has long been convention to use Markdown comments on Nix functions themselves for documentation. This exposes that information to `nix repl` users in a nice and formatted way. NixOS/rfcs#145 doc-comments are primarily what this feature is intended to consume, however, support for lambda documentation in the repl is experimental. We do our best effort to support the RFC here. These changes are based on [the nix-doc library](https://github.com/lf-/nix-doc) and are licensed under the terms described in the relevant source files. Change-Id: Ic6fe947d39a22540705d890737e336c4720b0a22
- Loading branch information
Showing
15 changed files
with
626 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
synopsis: Experimental REPL support for documentation comments using `:doc` | ||
cls: 564 | ||
--- | ||
|
||
Using `:doc` in the REPL now supports showing documentation comments when defined on a function. | ||
|
||
Previously this was only able to document builtins, however it now will show comments defined on a lambda as well. | ||
|
||
This support is experimental and relies on an embedded version of [nix-doc](https://github.com/lf-/nix-doc). | ||
|
||
The logic also supports limited Markdown formatting of doccomments and should easily support any [RFC 145](https://github.com/NixOS/rfcs/blob/master/rfcs/0145-doc-strings.md) | ||
compatible documentation comments in addition to simple commented documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-FileCopyrightText: 2024 Jade Lovelace | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause OR MIT | ||
|
||
/target | ||
result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
description = "Nix documentation grepping tool" | ||
edition = "2018" | ||
name = "nix-doc" | ||
version = "0.0.1" | ||
license = "BSD-2-Clause OR MIT" | ||
homepage = "https://github.com/lf-/nix-doc" | ||
repository = "https://github.com/lf-/nix-doc" | ||
|
||
[lib] | ||
crate_type = ["staticlib"] | ||
|
||
[dependencies] | ||
rnix = "0.8.0" | ||
|
||
[dev-dependencies] | ||
expect-test = "1.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
rustPlatform, | ||
lib | ||
}: | ||
|
||
rustPlatform.buildRustPackage { | ||
name = "nix-doc"; | ||
|
||
cargoHash = "sha256-HXL235loBJnRje7KaMCCCTighv6WNYRrZ/jgkAQbEY0="; | ||
src = lib.cleanSource ./.; | ||
} |
Oops, something went wrong.