mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
Impl make::blank_line
This commit is contained in:
parent
07ff9eeca8
commit
952f385682
3 changed files with 20 additions and 27 deletions
|
@ -339,7 +339,7 @@ pub mod tokens {
|
|||
use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken};
|
||||
|
||||
pub(super) static SOURCE_FILE: Lazy<Parse<SourceFile>> =
|
||||
Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;"));
|
||||
Lazy::new(|| SourceFile::parse("const C: <()>::Item = (1 != 1, 2 == 2, !true)\n;\n\n"));
|
||||
|
||||
pub fn single_space() -> SyntaxToken {
|
||||
SOURCE_FILE
|
||||
|
@ -379,6 +379,16 @@ pub mod tokens {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn blank_line() -> SyntaxToken {
|
||||
SOURCE_FILE
|
||||
.tree()
|
||||
.syntax()
|
||||
.descendants_with_tokens()
|
||||
.filter_map(|it| it.into_token())
|
||||
.find(|it| it.kind() == WHITESPACE && it.text().as_str() == "\n\n")
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub struct WsBuilder(SourceFile);
|
||||
|
||||
impl WsBuilder {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue