ruff/crates/ty_ide/src
Andrew Gallant b6a29592e7 [ty] Add a new abstraction for adding imports to a module
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.
2025-09-17 13:59:28 -04:00
..
all_symbols.rs [ty] Add module to result returned by "all symbols" API 2025-09-17 13:59:28 -04:00
completion.rs [ty] Refactor to handle unimported completions 2025-09-17 13:59:28 -04:00
doc_highlights.rs [ty] Added support for "document highlights" language server feature. (#19515) 2025-07-24 13:06:25 -07:00
docstring.rs [ty] render docstrings in hover (#19882) 2025-08-13 14:59:20 +00:00
document_symbols.rs [ty] Rejigger workspace symbols for more efficient caching 2025-08-23 12:53:41 -04:00
find_node.rs [ty] fix GotoTargets for keyword args in nested function calls (#20013) 2025-08-21 20:19:52 +00:00
goto.rs [ty] Make initializer calls GotoTargets (#20014) 2025-09-02 14:49:14 -04:00
goto_declaration.rs [ty] Make initializer calls GotoTargets (#20014) 2025-09-02 14:49:14 -04:00
goto_definition.rs [ty] Make initializer calls GotoTargets (#20014) 2025-09-02 14:49:14 -04:00
goto_references.rs [ty] Use dedent in cursor tests (#20019) 2025-08-21 10:31:54 +02:00
goto_type_definition.rs [ty] Sync vendored typeshed stubs (#20394) 2025-09-15 09:30:28 +02:00
hover.rs [ty] Add support for generic PEP695 type aliases (#20219) 2025-09-08 13:26:21 -07:00
importer.rs [ty] Add a new abstraction for adding imports to a module 2025-09-17 13:59:28 -04:00
inlay_hints.rs [ty] Refactor inlay hints structure to use separate parts (#20052) 2025-08-26 10:21:31 +05:30
lib.rs [ty] Add a new abstraction for adding imports to a module 2025-09-17 13:59:28 -04:00
markup.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
references.rs [ty] render docstrings in hover (#19882) 2025-08-13 14:59:20 +00:00
rename.rs [ty] render docstrings in hover (#19882) 2025-08-13 14:59:20 +00:00
selection_range.rs [ty] fix GotoTargets for keyword args in nested function calls (#20013) 2025-08-21 20:19:52 +00:00
semantic_tokens.rs [ty] Use dedent in cursor tests (#20019) 2025-08-21 10:31:54 +02:00
signature_help.rs [ty] add more lsp tests for overloads (#20148) 2025-09-02 10:38:26 -04:00
stub_mapping.rs [ty] Implement non-stdlib stub mapping for classes and functions (#19471) 2025-07-22 12:42:55 +00:00
symbols.rs [ty] Move CompletionKind to ty_ide 2025-09-17 13:59:28 -04:00
workspace_symbols.rs [ty] Rejigger workspace symbols for more efficient caching 2025-08-23 12:53:41 -04:00