Inline-diagnostics for users typing a prompt
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 817
- Forks
- 247
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 30
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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed changes across nu-cli, reedline, and nu-lint, including the optional feature flag, generic diagnostics provider, and nu-lint adapter mentioned in the issue. Confirm the desired configuration and minimum lint level behavior with maintainers, then define completion as an agreed, integrated implementation with tests for displaying diagnostics while typing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100