docs(diagnostic): severity names are sometimes allowed #39120

Problem: Using severity names (like "ERROR", "WARN") in functions like
  `vim.diganostic.get()` and `vim.diagnostic.config()` is allowed and
  tested for many years now. But documentation about it can be clearer.

Solution: Explicitly mention that severity names are allowed in some
  situations. Ideally, it would also require updating typing for
  `vim.diagnostic.SeverityFilter`, but that looks problematic to do
  robustly.
This commit is contained in:
Evgeni Chasnovski
2026-04-16 17:32:35 +03:00
committed by GitHub
parent 3cca237984
commit 711f3cc299

View File

@@ -48,7 +48,8 @@ The "severity" key in a diagnostic is one of the values defined in
vim.diagnostic.severity.HINT
Functions that take a severity as an optional parameter (e.g.
|vim.diagnostic.get()|) accept one of three forms:
|vim.diagnostic.get()|) allow using severity names (like "ERROR") as well as
values and accept one of three forms:
1. A single |vim.diagnostic.severity| value: >lua