mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Properly reacto to keywords
This commit is contained in:
parent
cc43abcde8
commit
57a260f579
6 changed files with 28 additions and 4 deletions
|
@ -115,6 +115,16 @@ pub(crate) fn if_is_prev(element: SyntaxElement) -> bool {
|
|||
.filter(|it| it.kind() == IF_KW)
|
||||
.is_some()
|
||||
}
|
||||
|
||||
// TODO kb generify?
|
||||
pub(crate) fn mod_is_prev(element: SyntaxElement) -> bool {
|
||||
element
|
||||
.into_token()
|
||||
.and_then(|it| previous_non_trivia_token(it))
|
||||
.filter(|it| it.kind() == MOD_KW)
|
||||
.is_some()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_if_is_prev() {
|
||||
check_pattern_is_applicable(r"if l<|>", if_is_prev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue