mirror of
https://github.com/astral-sh/ruff.git
synced 2026-11-21 12:16:15 +08:00
Future autofixes will need to introduce imports alongside code changes. In particular, there are cases where inserting `assert_never(...)` would be useful, but the fix often also needs to import `assert_never`. The importer currently lives in `ty_ide`, so diagnostics emitted by `ty_python_semantic` cannot use it. Move the importer into `ty_python_semantic` and reuse it from completions and inlay hints. As its first use in a diagnostic, attach the `reveal_type` import fix directly to `undefined-reveal`, replacing the custom LSP handling. The fix imports from `typing` on Python 3.11+ and `typing_extensions` on older Python versions. Cache source-style detection and top-level import discovery in Salsa per file, so diagnostics in separate inference regions and IDE features can share the setup. The cached data does not retain the parsed AST or a copy of the source text. Stacked on #28169.
ruff_python_codegen
This crate is an internal component of Ruff. The Rust API exposed here is unstable and will have frequent breaking changes.
This version (0.0.12) is a component of Ruff 0.16.6. The source can be found here.
See Ruff's crate versioning policy for details on versioning.