mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Properly handle doc attributes in doc-comment highlight injection
This commit is contained in:
parent
3daa302cd3
commit
c766492d26
5 changed files with 84 additions and 8 deletions
|
@ -162,7 +162,6 @@ impl RawAttrs {
|
|||
let attr = ast::Attr::parse(&format!("#[{}]", tree)).ok()?;
|
||||
// FIXME hygiene
|
||||
let hygiene = Hygiene::new_unhygienic();
|
||||
// FIXME same index is assigned to multiple attributes
|
||||
Attr::from_src(attr, &hygiene).map(|attr| Attr { index, ..attr })
|
||||
});
|
||||
|
||||
|
@ -450,6 +449,13 @@ impl Attr {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn string_value(&self) -> Option<&SmolStr> {
|
||||
match self.input.as_ref()? {
|
||||
AttrInput::Literal(it) => Some(it),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue