mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
parent
b3ef934ccb
commit
25242fe93f
395 changed files with 14569 additions and 5755 deletions
|
@ -140,16 +140,11 @@ impl FileSetConfig {
|
|||
}
|
||||
|
||||
/// Builder for [`FileSetConfig`].
|
||||
#[derive(Default)]
|
||||
pub struct FileSetConfigBuilder {
|
||||
roots: Vec<Vec<VfsPath>>,
|
||||
}
|
||||
|
||||
impl Default for FileSetConfigBuilder {
|
||||
fn default() -> Self {
|
||||
FileSetConfigBuilder { roots: Vec::new() }
|
||||
}
|
||||
}
|
||||
|
||||
impl FileSetConfigBuilder {
|
||||
/// Returns the number of sets currently held.
|
||||
pub fn len(&self) -> usize {
|
||||
|
|
|
@ -59,15 +59,10 @@ pub use paths::{AbsPath, AbsPathBuf};
|
|||
/// Handle to a file in [`Vfs`]
|
||||
///
|
||||
/// Most functions in rust-analyzer use this when they need to refer to a file.
|
||||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
pub struct FileId(pub u32);
|
||||
|
||||
impl stdx::hash::NoHashHashable for FileId {}
|
||||
impl std::hash::Hash for FileId {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.0.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage for all files read by rust-analyzer.
|
||||
///
|
||||
|
|
|
@ -9,16 +9,11 @@ use rustc_hash::FxHasher;
|
|||
use crate::{FileId, VfsPath};
|
||||
|
||||
/// Structure to map between [`VfsPath`] and [`FileId`].
|
||||
#[derive(Default)]
|
||||
pub(crate) struct PathInterner {
|
||||
map: IndexSet<VfsPath, BuildHasherDefault<FxHasher>>,
|
||||
}
|
||||
|
||||
impl Default for PathInterner {
|
||||
fn default() -> Self {
|
||||
Self { map: IndexSet::default() }
|
||||
}
|
||||
}
|
||||
|
||||
impl PathInterner {
|
||||
/// Get the id corresponding to `path`.
|
||||
///
|
||||
|
|
|
@ -364,7 +364,7 @@ impl VirtualPath {
|
|||
path = &path["../".len()..];
|
||||
}
|
||||
path = path.trim_start_matches("./");
|
||||
res.0 = format!("{}/{}", res.0, path);
|
||||
res.0 = format!("{}/{path}", res.0);
|
||||
Some(res)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue