Skip to content

Commit 0bbd642

Browse files
committed
Added tests for no auto-completion on comments
1 parent a33eefa commit 0bbd642

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

crates/ra_ide/src/completion/presentation.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,4 +1516,54 @@ mod tests {
15161516
"###
15171517
);
15181518
}
1519+
1520+
#[test]
1521+
fn no_keyword_autocompletion_on_line_comments() {
1522+
assert_debug_snapshot!(
1523+
do_completion(
1524+
r"
1525+
fn test() {
1526+
let x = 2; // A comment<|>
1527+
}
1528+
",
1529+
CompletionKind::Keyword
1530+
),
1531+
@r###"
1532+
[]
1533+
"###
1534+
);
1535+
}
1536+
1537+
#[test]
1538+
fn no_keyword_autocompletion_on_multi_line_comments() {
1539+
assert_debug_snapshot!(
1540+
do_completion(
1541+
r"
1542+
/*
1543+
Some multi-line comment<|>
1544+
*/
1545+
",
1546+
CompletionKind::Keyword
1547+
),
1548+
@r###"
1549+
[]
1550+
"###
1551+
);
1552+
}
1553+
1554+
#[test]
1555+
fn no_keyword_autocompletion_on_doc_comments() {
1556+
assert_debug_snapshot!(
1557+
do_completion(
1558+
r"
1559+
/// Some doc comment
1560+
/// let test<|> = 1
1561+
",
1562+
CompletionKind::Keyword
1563+
),
1564+
@r###"
1565+
[]
1566+
"###
1567+
);
1568+
}
15191569
}

0 commit comments

Comments
 (0)