mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-23 03:44:23 +00:00
Restrict completions inside visibility modifiers
This commit is contained in:
parent
ea105f9396
commit
f6cb42fdb8
7 changed files with 53 additions and 9 deletions
|
@ -211,6 +211,14 @@ fn validate_numeric_name(name_ref: Option<ast::NameRef>, errors: &mut Vec<Syntax
|
|||
}
|
||||
|
||||
fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
|
||||
if vis.in_token().is_none() {
|
||||
if vis.path().and_then(|p| p.as_single_name_ref()).and_then(|n| n.ident_token()).is_some() {
|
||||
errors.push(SyntaxError::new(
|
||||
"incorrect visibility restriction",
|
||||
vis.syntax.text_range(),
|
||||
));
|
||||
}
|
||||
}
|
||||
let parent = match vis.syntax().parent() {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue