mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Move raw_delimiter_count
to syntax
crate
This commit is contained in:
parent
e8c9ca2a2f
commit
6cd458f3d0
2 changed files with 13 additions and 10 deletions
|
@ -204,6 +204,16 @@ pub trait IsString: AstToken {
|
|||
assert!(TextRange::up_to(contents_range.len()).contains_range(range));
|
||||
Some(range + contents_range.start())
|
||||
}
|
||||
fn raw_delimiter_count(&self) -> Option<u8> {
|
||||
let text = self.text();
|
||||
let quote_range = self.text_range_between_quotes()?;
|
||||
let range_start = self.syntax().text_range().start();
|
||||
text[TextRange::up_to((quote_range - range_start).start())]
|
||||
.matches('#')
|
||||
.count()
|
||||
.try_into()
|
||||
.ok()
|
||||
}
|
||||
}
|
||||
|
||||
impl IsString for ast::String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue