mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Thread file id through descension API for semantic highlighting
This commit is contained in:
parent
354ab7a9e8
commit
c2a07e21f5
3 changed files with 115 additions and 73 deletions
|
@ -461,3 +461,12 @@ impl<N: AstNode> InFile<N> {
|
|||
Some(InRealFile::new(file_id, value))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> InFile<T> {
|
||||
pub fn into_real_file(self) -> Result<InRealFile<T>, InFile<T>> {
|
||||
match self.file_id.repr() {
|
||||
HirFileIdRepr::FileId(file_id) => Ok(InRealFile { file_id, value: self.value }),
|
||||
HirFileIdRepr::MacroFile(_) => Err(self),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue