[ty] Make auto-import completions opt-in via an experimental option

Instead of waiting to land auto-import until it is "ready
for users," it'd be nicer to get incremental progress merged
to `main`. By making it an experimental opt-in, we avoid making
the default completion experience worse but permit developers
and motivated users to try it.
This commit is contained in:
Andrew Gallant 2025-08-29 14:44:56 -04:00 committed by Andrew Gallant
parent 8e52027a88
commit 0a0eaf5a9b
7 changed files with 63 additions and 16 deletions

View file

@ -415,7 +415,11 @@ impl Workspace {
let offset = position.to_text_size(&source, &index, self.position_encoding)?;
let completions = ty_ide::completion(&self.db, file_id.file, offset);
// NOTE: At time of writing, 2025-08-29, auto-import isn't
// ready to be enabled by default yet. Once it is, we should
// either just enable it or provide a way to configure it.
let settings = ty_ide::CompletionSettings { auto_import: false };
let completions = ty_ide::completion(&self.db, &settings, file_id.file, offset);
Ok(completions
.into_iter()