diff options
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index e7eeb60ee..7d6d24369 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -46,32 +46,32 @@ fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> | |||
46 | /// snapshot of the file systems, and `analysis_host`, which stores our | 46 | /// snapshot of the file systems, and `analysis_host`, which stores our |
47 | /// incremental salsa database. | 47 | /// incremental salsa database. |
48 | #[derive(Debug)] | 48 | #[derive(Debug)] |
49 | pub struct GlobalState { | 49 | pub(crate) struct GlobalState { |
50 | pub config: Config, | 50 | pub(crate) config: Config, |
51 | pub workspaces: Arc<Vec<ProjectWorkspace>>, | 51 | pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>, |
52 | pub analysis_host: AnalysisHost, | 52 | pub(crate) analysis_host: AnalysisHost, |
53 | pub loader: Box<dyn vfs::loader::Handle>, | 53 | pub(crate) loader: Box<dyn vfs::loader::Handle>, |
54 | pub task_receiver: Receiver<vfs::loader::Message>, | 54 | pub(crate) task_receiver: Receiver<vfs::loader::Message>, |
55 | pub flycheck: Option<Flycheck>, | 55 | pub(crate) flycheck: Option<Flycheck>, |
56 | pub diagnostics: DiagnosticCollection, | 56 | pub(crate) diagnostics: DiagnosticCollection, |
57 | pub proc_macro_client: ProcMacroClient, | 57 | pub(crate) proc_macro_client: ProcMacroClient, |
58 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | 58 | pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, |
59 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, | 59 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, |
60 | source_root_config: SourceRootConfig, | 60 | source_root_config: SourceRootConfig, |
61 | } | 61 | } |
62 | 62 | ||
63 | /// An immutable snapshot of the world's state at a point in time. | 63 | /// An immutable snapshot of the world's state at a point in time. |
64 | pub struct GlobalStateSnapshot { | 64 | pub(crate) struct GlobalStateSnapshot { |
65 | pub config: Config, | 65 | pub(crate) config: Config, |
66 | pub workspaces: Arc<Vec<ProjectWorkspace>>, | 66 | pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>, |
67 | pub analysis: Analysis, | 67 | pub(crate) analysis: Analysis, |
68 | pub check_fixes: CheckFixes, | 68 | pub(crate) check_fixes: CheckFixes, |
69 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, | 69 | pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, |
70 | vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, | 70 | vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, |
71 | } | 71 | } |
72 | 72 | ||
73 | impl GlobalState { | 73 | impl GlobalState { |
74 | pub fn new( | 74 | pub(crate) fn new( |
75 | workspaces: Vec<ProjectWorkspace>, | 75 | workspaces: Vec<ProjectWorkspace>, |
76 | lru_capacity: Option<usize>, | 76 | lru_capacity: Option<usize>, |
77 | config: Config, | 77 | config: Config, |
@@ -241,7 +241,7 @@ impl GlobalStateSnapshot { | |||
241 | self.vfs.read().1[&id] | 241 | self.vfs.read().1[&id] |
242 | } | 242 | } |
243 | 243 | ||
244 | pub fn anchored_path(&self, file_id: FileId, path: &str) -> Url { | 244 | pub(crate) fn anchored_path(&self, file_id: FileId, path: &str) -> Url { |
245 | let mut base = self.vfs.read().0.file_path(file_id); | 245 | let mut base = self.vfs.read().0.file_path(file_id); |
246 | base.pop(); | 246 | base.pop(); |
247 | let path = base.join(path); | 247 | let path = base.join(path); |
@@ -264,7 +264,7 @@ impl GlobalStateSnapshot { | |||
264 | }) | 264 | }) |
265 | } | 265 | } |
266 | 266 | ||
267 | pub fn status(&self) -> String { | 267 | pub(crate) fn status(&self) -> String { |
268 | let mut buf = String::new(); | 268 | let mut buf = String::new(); |
269 | if self.workspaces.is_empty() { | 269 | if self.workspaces.is_empty() { |
270 | buf.push_str("no workspaces\n") | 270 | buf.push_str("no workspaces\n") |
@@ -349,7 +349,7 @@ pub(crate) struct SourceRootConfig { | |||
349 | } | 349 | } |
350 | 350 | ||
351 | impl SourceRootConfig { | 351 | impl SourceRootConfig { |
352 | pub fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { | 352 | pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { |
353 | self.fsc | 353 | self.fsc |
354 | .partition(vfs) | 354 | .partition(vfs) |
355 | .into_iter() | 355 | .into_iter() |