Add completion.autoimport.insertQualifiedPath config option - #23349
its-wasabi wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
b97eb86 to
376771e
Compare
Adds an opt-in config flag that, when enabled, makes flyimport completions insert the fully qualified path directly instead of the short name plus a use import. Addresses rust-lang#13953.
376771e to
f2a02b1
Compare
| { | ||
| import.import_path.display(db, completion.edition).to_smolstr() | ||
| } else { | ||
| name.clone() |
There was a problem hiding this comment.
Maybe it's cleaner this way?
let (mut insert_text, mut item) = render_resolution_simple_(ctx, &local_name, import_to_add, resolution);
There was a problem hiding this comment.
done. Now render_resolution_simple_ takes name and returns (insert_text, item) to avoid repetitive display calls.
| render_macro_pat(ctx, pattern_ctx, local_name, mac) | ||
| } else { | ||
| render_resolution_simple_(ctx, &local_name, import_to_add, resolution) | ||
| let name = local_name.display(ctx.db(), ctx.completion.edition).to_smolstr(); |
There was a problem hiding this comment.
After #23364, this can be completely moved into render_resolution_simple_
There was a problem hiding this comment.
Done, moved let name = ... into render_resolution_simple_ and created small return
struct to avoid tuple with ambiguous fields (name is further used in render_resolution_path).
Also I can rebase once #23364 merges, since it touches same lines but changes are independent.
|
Understood, please let me know if there's any concern beyond config surface. It fills a real gap for users who prefer qualified paths over
It's opt-in, a light change, and defaults to I did consider per-module/type setting for finer control, but kept it to a single bool to minimize config surface |
|
Personally I support this feature, but let's ask @rust-lang/rust-analyzer. |
|
IMO it does make sense to have a setting for this. |
Adds an opt-in config flag that, when enabled, makes flyimport completions insert
the fully qualified path directly instead of the short name plus a
useimport.The flag defaults to
false, so there is no behavior change for existing users.Addresses #13953.