-
Notifications
You must be signed in to change notification settings - Fork 197
Description
I am working on a patch that adds inline diagnostics to (partial) Nu prompt based on the linter I made for Nu (nu-lint).
The diagnostics would be shown in real-time as they type (with optional debounce of ~ 300 ms).
Users would have the ability to configure it with a bool or the nu-lint config as in:
$env.config.inline_diagnostics = true
$env.config.inline_diagnostics = {
ignored: ["snake_case_variables"]
rules: { trailing_whitespace: "error" }
groups: { naming: "warning" }
max_pipeline_length: 100
}While typing they get something that looks like this (the violations displayed below are just examples)
❯ $env.config.inline_diagnostics = true
wvhulle ~/Code/nushell inline-diagnostics ≡
❯ ^head -20 ./README.md | lines
╰─ Unnecessary '^' prefix on external command 'head'
╰─ Nushell only checks the final external command's exit code in pipelines.
╰─ Use 'first N' to get the first N items
Is this something that might interest you?
I patched nu-cli (to depend on nu-lint optionally with a feature flag and connect its output with reedline) and reedline (for displaying diagnostics from a generic provider). I added an adapter in nu-lint to provide data in the right format to reedline. It is in early stages of development.
Users would be able to set a minimum lint level so they don't get spammed by eager lints.
Here is a screenshot of the above sample, so you can see the colors:
