mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Merge #116
116: Collapse comments upon join r=matklad a=aochagavia Todo: - [x] Write tests - [x] Resolve fixmes - [x] Implement `comment_start_length` using the parser I left a bunch of questions as fixmes. Can someone take a look at them? Also, I would love to use the parser to calculate the length of the leading characters in a comment (`//`, `///`, `//!`, `/*`), so any hints are greatly appreciated. Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com> Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
This commit is contained in:
commit
77e9bf9b5f
4 changed files with 199 additions and 58 deletions
|
@ -231,6 +231,24 @@ impl<'a> AstNode<'a> for CastExpr<'a> {
|
|||
|
||||
impl<'a> CastExpr<'a> {}
|
||||
|
||||
// Comment
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Comment<'a> {
|
||||
syntax: SyntaxNodeRef<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AstNode<'a> for Comment<'a> {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
COMMENT => Some(Comment { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> Comment<'a> {}
|
||||
|
||||
// Condition
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Condition<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue