⬆️ rust-analyzer

This commit is contained in:
Laurențiu Nicola 2022-08-30 14:51:24 +03:00
parent 31519bb394
commit 3e358a6827
74 changed files with 2091 additions and 951 deletions

View file

@ -6,6 +6,7 @@ use std::fmt;
use fst::{IntoStreamer, Streamer};
use rustc_hash::FxHashMap;
use stdx::hash::NoHashHashMap;
use crate::{AnchoredPath, FileId, Vfs, VfsPath};
@ -13,7 +14,7 @@ use crate::{AnchoredPath, FileId, Vfs, VfsPath};
#[derive(Default, Clone, Eq, PartialEq)]
pub struct FileSet {
files: FxHashMap<VfsPath, FileId>,
paths: FxHashMap<FileId, VfsPath>,
paths: NoHashHashMap<FileId, VfsPath>,
}
impl FileSet {

View file

@ -59,9 +59,16 @@ 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, Hash)]
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
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.
///
/// For more information see the [crate-level](crate) documentation.