mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-12 21:36:55 +00:00
workspace
This commit is contained in:
parent
5749b7df98
commit
75385e0254
8 changed files with 776 additions and 0 deletions
30
crates/djls-workspace/src/lib.rs
Normal file
30
crates/djls-workspace/src/lib.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
mod bridge;
|
||||
mod db;
|
||||
mod vfs;
|
||||
|
||||
// Re-export public API
|
||||
pub use bridge::FileStore;
|
||||
pub use db::{Database, FileKindMini, SourceFile, TemplateLoaderOrder};
|
||||
pub use vfs::{FileKind, FileMeta, FileRecord, Revision, TextSource, Vfs, VfsSnapshot};
|
||||
|
||||
/// Stable, compact identifier for files across the subsystem.
|
||||
///
|
||||
/// [`FileId`] decouples file identity from paths/URIs, providing efficient keys for maps and
|
||||
/// Salsa inputs. Once assigned to a file (via its URI), a [`FileId`] remains stable for the
|
||||
/// lifetime of the VFS, even if the file's content or metadata changes.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
||||
pub struct FileId(u32);
|
||||
|
||||
impl FileId {
|
||||
/// Create a [`FileId`] from a raw u32 value.
|
||||
#[must_use]
|
||||
pub fn from_raw(raw: u32) -> Self {
|
||||
FileId(raw)
|
||||
}
|
||||
|
||||
/// Get the underlying u32 index value.
|
||||
#[must_use]
|
||||
pub fn index(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue