feat(common): list formatting
This commit is contained in:
parent
2e9de16e90
commit
de4ff9aa61
6 changed files with 337 additions and 133 deletions
|
|
@ -76,6 +76,22 @@ pub fn filter_token(
|
|||
#[derive(Default, Eq)]
|
||||
pub struct Token(pub(crate) Option<SyntaxToken>);
|
||||
|
||||
impl Token {
|
||||
pub fn start(&self) -> u32 {
|
||||
match &self.0 {
|
||||
Some(t) => t.text_range().start().into(),
|
||||
None => 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end(&self) -> u32 {
|
||||
match &self.0 {
|
||||
Some(t) => t.text_range().end().into(),
|
||||
None => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for Token {
|
||||
fn as_ref(&self) -> &str {
|
||||
match &self.0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue