Print docs of expressions returning lambdas in the REPL #1167
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1167
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is your feature request related to a problem? Please describe.
Sometimes you're in the middle of writing a mildly-long expression using a certain function, when you forget the exact signature or behavior of it (e.g. after writing the first argument), at which point you have two options:
«lambda stuff @ /some/path»), then type:doc lib.annoying.stuff(yes, there's TAB, but still), enter, ↑↑, and finally resume typing your expression:doc, then ↑↑ restart typing, then enter, then oh fuck i forgot the :doc then restart, then ctrl+← again, then remove, then enter, then sighDescribe the solution you'd like
If the result of an expression is a non-fully-applied function, print the docs for it (if any) in addition to the
«lambda stuff @ /some/path»output it already gave.Describe alternatives you've considered
Since this is a somewhat opinionated request, one alternative would be to gate this behind some kind of option.
Alternatively, although this is less discoverable and is more of a "long-term dream," improvements in the repl's interface itself, such as keyboard shortcuts or popups, could be helpful in showing docs when the user needs them most but without overloading the repl's output.
The final alternative is to just... not change anything ¯\_(ツ)_/¯
Additional context
With regards to adding this as an option: there is some questions to be answered as to what's the best way to add them.
In addition, i also recognize that the current way the docs work have some problems that could interfere with this scenario. The biggest one I can think of is that the output of
:docfor partial functions can be a little confusing if you're not expecting it: although the signature in the header only contains parameters that haven't been supplied yet, the body of the documentation (which is a lot more attention-grabbing than the tiny discrete signature at the top) still has the full list of input, since to nix's eyes it's just formatted text instead of having a clear separate parameter section with an individual part for each parameterIt feels like to me that it would make sense to allow a project called
repl2where we would use better technologies to build a much more convenient REPL (perhaps while leveraging the Rust FFI we have) where things like LSP-style inline documentation of things under the cursor are available.In that regards, the question becomes: how much is it worth to spend time retrofitting these features inside the current REPL?
I do not have a strong opinion on getting documentation printed at the same time with these sorts of values but I suspect this requires a layering violation to do well.
@pennae @qyriad thoughts?
retrofitting these functions in the repl is not the problem here, it's that our data model fundamentally does not allow the feature that's being asked in the cl we linked to exist. the feature asked for in the original post is relatively easy to add, but the ux challenges we inherit from our nearly nonexistent config system make it bullshit hard even for a new repl