mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
refactor to use remove_range
and replace_range
instead of TextEdit
This commit is contained in:
parent
64342599ca
commit
94d96b60f3
47 changed files with 619 additions and 755 deletions
|
@ -15,18 +15,26 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
hir::Def::Module(module) => {
|
||||
let module_scope = module.scope(ctx.db);
|
||||
for (name, res) in module_scope.entries() {
|
||||
CompletionItem::new(CompletionKind::Reference, ctx, name.to_string())
|
||||
.from_resolution(ctx, res)
|
||||
.add_to(acc);
|
||||
CompletionItem::new(
|
||||
CompletionKind::Reference,
|
||||
ctx.leaf_range(),
|
||||
name.to_string(),
|
||||
)
|
||||
.from_resolution(ctx, res)
|
||||
.add_to(acc);
|
||||
}
|
||||
}
|
||||
hir::Def::Enum(e) => {
|
||||
e.variants(ctx.db)
|
||||
.into_iter()
|
||||
.for_each(|(variant_name, _variant)| {
|
||||
CompletionItem::new(CompletionKind::Reference, ctx, variant_name.to_string())
|
||||
.kind(CompletionItemKind::EnumVariant)
|
||||
.add_to(acc)
|
||||
CompletionItem::new(
|
||||
CompletionKind::Reference,
|
||||
ctx.leaf_range(),
|
||||
variant_name.to_string(),
|
||||
)
|
||||
.kind(CompletionItemKind::EnumVariant)
|
||||
.add_to(acc)
|
||||
});
|
||||
}
|
||||
_ => return,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue