mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Treat comments beginning with four slashes as regular line comments
This commit is contained in:
parent
da1f316b02
commit
b6560e3ebb
2 changed files with 16 additions and 0 deletions
|
@ -242,6 +242,21 @@ fn test_comments_preserve_trailing_whitespace() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_four_slash_line_comment() {
|
||||
let file = SourceFile::parse(
|
||||
r#"
|
||||
//// too many slashes to be a doc comment
|
||||
/// doc comment
|
||||
mod foo {}
|
||||
"#,
|
||||
)
|
||||
.ok()
|
||||
.unwrap();
|
||||
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
|
||||
assert_eq!("doc comment", module.doc_comment_text().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_where_predicates() {
|
||||
fn assert_bound(text: &str, bound: Option<TypeBound>) {
|
||||
|
|
|
@ -48,6 +48,7 @@ pub enum CommentPlacement {
|
|||
const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
|
||||
use {CommentPlacement::*, CommentShape::*};
|
||||
&[
|
||||
("////", CommentKind { shape: Line, doc: None }),
|
||||
("///", CommentKind { shape: Line, doc: Some(Outer) }),
|
||||
("//!", CommentKind { shape: Line, doc: Some(Inner) }),
|
||||
("/**", CommentKind { shape: Block, doc: Some(Outer) }),
|
||||
|
|
Loading…
Reference in a new issue