Skip to content
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

Document the different diagnostic levels #11592

Open
jerabaul29 opened this issue Aug 27, 2024 · 2 comments
Open

Document the different diagnostic levels #11592

jerabaul29 opened this issue Aug 27, 2024 · 2 comments
Labels
A-documentation Area: Documentation improvements

Comments

@jerabaul29
Copy link
Contributor

In https://github.com/helix-editor/helix/blob/master/book/src/editor.md , I could not find a documentation for the valid diagnostic levels; for example, in section

helix/book/src/editor.md

Lines 399 to 435 in af7a1fd

### `[editor.inline-diagnostics]` Section
Options for rendering diagnostics inside the text like shown below
```
fn main() {
let foo = bar;
└─ no such value in this scope
}
````
| Key | Description | Default |
|------------|-------------|---------|
| `cursor-line` | The minimum severity that a diagnostic must have to be shown inline on the line that contains the primary cursor. Set to `disable` to not show any diagnostics inline. This option does not have any effect when in insert-mode and will only take effect 350ms after moving the cursor to a different line. | `"disable"` |
| `other-lines` | The minimum severity that a diagnostic must have to be shown inline on a line that does not contain the cursor-line. Set to `disable` to not show any diagnostics inline. | `"disable"` |
| `prefix-len` | How many horizontal bars `` are rendered before the diagnostic text. | `1` |
| `max-wrap` | Equivalent of the `editor.soft-wrap.max-wrap` option for diagnostics. | `20` |
| `max-diagnostics` | Maximum number of diagnostics to render inline for a given line | `10` |
The (first) diagnostic with the highest severity that is not shown inline is rendered at the end of the line (as long as its severity is higher than the `end-of-line-diagnostics` config option):
```
fn main() {
let baz = 1;
let foo = bar; a local variable with a similar name exists: baz
└─ no such value in this scope
}
```
The new diagnostic rendering is not yet enabled by default. As soon as end of line or inline diagnostics are enabled the old diagnostics rendering is automatically disabled. The recommended default setting are:
```
end-of-line-diagnostics = "hint"
[editor.inline-diagnostics]
cursor-line = "warning" # show warnings and errors on the cursorline inline
```

it is not clear to me, reading just this section, what values are ok to use for e.g. cursor-line .

@jerabaul29
Copy link
Contributor Author

Ok, after a bit of digging I could find this information at:

| `diagnostic-severity` | Minimal severity of diagnostic for it to be displayed. (Allowed values: `Error`, `Warning`, `Info`, `Hint`) |

not sure how this could be made easier to find? It was a bit of digging to find it. Should we add "see diagnostic-severity for admissible values", or "(Allowed values: Error, Warning, Info, Hint)", or something like this? Not sure how to document this effectively without putting the same boilerplate text again and again.

@the-mikedavis
Copy link
Member

I think we can add a paragraph below the table in this section that says that the allowed values are "hint", "info", "warning" and "error". I think it would be ok to reference some other config option for config.toml but linking to the languages.toml config could be confusing. Also that section in languages.md is incorrect about the levels: it should be lowercase "hint"/"info"/etc. instead of "Hint"/"Info"/etc.

@the-mikedavis the-mikedavis added the A-documentation Area: Documentation improvements label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Documentation improvements
Projects
None yet
Development

No branches or pull requests

2 participants