mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00
![]() This is somewhat inspired by a similar abstraction in `ruff_linter`. The main idea is to create an importer once for a module that you want to add imports to. And then call `import` to generate an edit for each symbol you want to add. I haven't done any performance profiling here yet. I don't know if it will be a bottleneck. In particular, I do expect `Importer::import` (but not `Importer::new`) to get called many times for a single completion request when auto-import is enabled. Particularly in projects with a lot of unimported symbols. Because I don't know the perf impact, I didn't do any premature optimization here. But there are surely some low hanging fruit if this does prove to be a problem. New tests make up a big portion of the diff here. I tried to think of a bunch of different cases, although I'm sure there are more. |
||
---|---|---|
.. | ||
all_symbols.rs | ||
completion.rs | ||
doc_highlights.rs | ||
docstring.rs | ||
document_symbols.rs | ||
find_node.rs | ||
goto.rs | ||
goto_declaration.rs | ||
goto_definition.rs | ||
goto_references.rs | ||
goto_type_definition.rs | ||
hover.rs | ||
importer.rs | ||
inlay_hints.rs | ||
lib.rs | ||
markup.rs | ||
references.rs | ||
rename.rs | ||
selection_range.rs | ||
semantic_tokens.rs | ||
signature_help.rs | ||
stub_mapping.rs | ||
symbols.rs | ||
workspace_symbols.rs |