File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,14 @@ mod os;
13
13
14
14
pub type Result < T > = std:: io:: Result < T > ;
15
15
16
- /// A file system that can be used to read and write files .
16
+ /// An abstraction over `std::fs` with features tailored to Ruff's needs .
17
17
///
18
- /// The file system is agnostic to the actual storage medium, it could be a real file system, a combination
19
- /// of a real file system and an in-memory file system in the case of an LSP where unsaved changes are stored in memory,
20
- /// or an all in-memory file system for testing.
18
+ /// Provides a file system agnostic API to interact with files and directories.
19
+ /// Abstracting the file system operations enables:
20
+ ///
21
+ /// * Accessing unsaved or even untitled files in the LSP use case
22
+ /// * Testing with an in-memory file system
23
+ /// * Running Ruff in a WASM environment without needing to stub out the full `std::fs` API.
21
24
pub trait FileSystem {
22
25
/// Reads the metadata of the file or directory at `path`.
23
26
fn metadata ( & self , path : & FileSystemPath ) -> Result < Metadata > ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ pub struct Vfs {
38
38
39
39
#[ derive( Default ) ]
40
40
struct VfsInner {
41
- /// Lookup table that maps the path to a salsa interned [`VfsFile`] instance .
41
+ /// Lookup table that maps [`VfsPath`]s to salsa interned [`VfsFile`] instances .
42
42
///
43
43
/// The map also stores entries for files that don't exist on the file system. This is necessary
44
44
/// so that queries that depend on the existence of a file are re-executed when the file is created.
@@ -93,7 +93,7 @@ impl Vfs {
93
93
} )
94
94
}
95
95
96
- /// Lookups a vendored file by its path. Returns `Some` if a vendored file for the given path
96
+ /// Looks up a vendored file by its path. Returns `Some` if a vendored file for the given path
97
97
/// exists and `None` otherwise.
98
98
pub fn vendored ( & self , db : & dyn Db , path : & VendoredPath ) -> Option < VfsFile > {
99
99
let file = match self
@@ -144,7 +144,7 @@ impl Vfs {
144
144
}
145
145
146
146
/// Creates a salsa like snapshot of the files. The instances share
147
- /// the same path to file mapping.
147
+ /// the same path-to- file mapping.
148
148
pub fn snapshot ( & self ) -> Self {
149
149
Self {
150
150
inner : self . inner . clone ( ) ,
You can’t perform that action at this time.
0 commit comments