mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-15 02:09:36 +00:00
Fix import search not discarding rawness
This commit is contained in:
parent
20ff27e2ba
commit
a06606c802
8 changed files with 65 additions and 29 deletions
|
|
@ -5,7 +5,7 @@ use ide_db::imports::{
|
|||
insert_use::ImportScope,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use syntax::{ast, AstNode, SyntaxNode, ToSmolStr, T};
|
||||
use syntax::{ast, AstNode, SyntaxNode, ToSmolStr};
|
||||
|
||||
use crate::{
|
||||
config::AutoImportExclusionType,
|
||||
|
|
@ -403,10 +403,11 @@ fn import_on_the_fly_method(
|
|||
|
||||
fn import_name(ctx: &CompletionContext<'_>) -> String {
|
||||
let token_kind = ctx.token.kind();
|
||||
if matches!(token_kind, T![.] | T![::]) {
|
||||
String::new()
|
||||
} else {
|
||||
|
||||
if token_kind.is_any_identifier() {
|
||||
ctx.token.to_string()
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ fn render_resolution_path(
|
|||
|
||||
let name = local_name.display_no_db(ctx.completion.edition).to_smolstr();
|
||||
let mut item = render_resolution_simple_(ctx, &local_name, import_to_add, resolution);
|
||||
if local_name.is_escaped(completion.edition) {
|
||||
if local_name.needs_escape(completion.edition) {
|
||||
item.insert_text(local_name.display_no_db(completion.edition).to_smolstr());
|
||||
}
|
||||
// Add `<>` for generic types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue