Allow navigation targets to be duplicated when the focus range lies in the macro definition site

This commit is contained in:
Lukas Wirth 2023-12-06 11:53:28 +01:00
parent 9b7ec5e31b
commit 9cb13b6efb
38 changed files with 851 additions and 488 deletions

View file

@ -60,11 +60,21 @@ pub use paths::{AbsPath, AbsPathBuf};
///
/// Most functions in rust-analyzer use this when they need to refer to a file.
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct FileId(pub u32);
pub struct FileId(u32);
impl FileId {
/// Think twice about using this outside of tests. If this ends up in a wrong place it will cause panics!
pub const BOGUS: FileId = FileId(u32::MAX);
pub const BOGUS: FileId = FileId(0xe4e4e);
#[inline]
pub fn from_raw(raw: u32) -> FileId {
FileId(raw)
}
#[inline]
pub fn index(self) -> u32 {
self.0
}
}
/// safe because `FileId` is a newtype of `u32`