mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Allow hints after 'fn' keyword if it's an impl trait block
This commit is contained in:
parent
8f303daf45
commit
6f573bd84f
3 changed files with 37 additions and 4 deletions
|
@ -104,6 +104,18 @@ pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) -
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn check_pattern_is_not_applicable(code: &str, check: fn(SyntaxElement) -> bool) {
|
||||
let (analysis, pos) = fixture::position(code);
|
||||
analysis
|
||||
.with_db(|db| {
|
||||
let sema = Semantics::new(db);
|
||||
let original_file = sema.parse(pos.file_id);
|
||||
let token = original_file.syntax().token_at_offset(pos.offset).left_biased().unwrap();
|
||||
assert!(!check(NodeOrToken::Token(token)));
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn get_all_completion_items(
|
||||
config: CompletionConfig,
|
||||
code: &str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue