mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Merge commit '3b7c7f97e4
' into sync-from-ra
This commit is contained in:
parent
6eaf3f8bb2
commit
d1d111d09e
177 changed files with 14930 additions and 2099 deletions
|
@ -169,6 +169,28 @@ pub fn completions(
|
|||
return Some(completions.into());
|
||||
}
|
||||
|
||||
// when the user types a bare `_` (that is it does not belong to an identifier)
|
||||
// the user might just wanted to type a `_` for type inference or pattern discarding
|
||||
// so try to suppress completions in those cases
|
||||
if trigger_character == Some('_') && ctx.original_token.kind() == syntax::SyntaxKind::UNDERSCORE
|
||||
{
|
||||
if let CompletionAnalysis::NameRef(NameRefContext {
|
||||
kind:
|
||||
NameRefKind::Path(
|
||||
path_ctx @ PathCompletionCtx {
|
||||
kind: PathKind::Type { .. } | PathKind::Pat { .. },
|
||||
..
|
||||
},
|
||||
),
|
||||
..
|
||||
}) = analysis
|
||||
{
|
||||
if path_ctx.is_trivial_path() {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let acc = &mut completions;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue