mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Don't show incorrect completions after unsafe or visiblity node
This commit is contained in:
parent
1a8f76a224
commit
9ea6ee6b27
4 changed files with 38 additions and 42 deletions
|
@ -311,13 +311,16 @@ impl<'a> CompletionContext<'a> {
|
|||
}
|
||||
|
||||
pub(crate) fn is_path_disallowed(&self) -> bool {
|
||||
matches!(
|
||||
self.completion_location,
|
||||
Some(ImmediateLocation::Attribute(_))
|
||||
| Some(ImmediateLocation::ModDeclaration(_))
|
||||
| Some(ImmediateLocation::RecordPat(_))
|
||||
| Some(ImmediateLocation::RecordExpr(_))
|
||||
) || self.attribute_under_caret.is_some()
|
||||
self.attribute_under_caret.is_some()
|
||||
|| self.previous_token_is(T![unsafe])
|
||||
|| self.has_visibility_prev_sibling()
|
||||
|| matches!(
|
||||
self.completion_location,
|
||||
Some(ImmediateLocation::Attribute(_))
|
||||
| Some(ImmediateLocation::ModDeclaration(_))
|
||||
| Some(ImmediateLocation::RecordPat(_))
|
||||
| Some(ImmediateLocation::RecordExpr(_))
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn expects_expression(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue