Cleanup visibility

This commit is contained in:
Aleksey Kladov 2020-06-24 18:54:05 +02:00
parent 946b2c28a7
commit d6c204c750

View file

@ -46,32 +46,32 @@ fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) ->
/// snapshot of the file systems, and `analysis_host`, which stores our /// snapshot of the file systems, and `analysis_host`, which stores our
/// incremental salsa database. /// incremental salsa database.
#[derive(Debug)] #[derive(Debug)]
pub struct GlobalState { pub(crate) struct GlobalState {
pub config: Config, pub(crate) config: Config,
pub workspaces: Arc<Vec<ProjectWorkspace>>, pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
pub analysis_host: AnalysisHost, pub(crate) analysis_host: AnalysisHost,
pub loader: Box<dyn vfs::loader::Handle>, pub(crate) loader: Box<dyn vfs::loader::Handle>,
pub task_receiver: Receiver<vfs::loader::Message>, pub(crate) task_receiver: Receiver<vfs::loader::Message>,
pub flycheck: Option<Flycheck>, pub(crate) flycheck: Option<Flycheck>,
pub diagnostics: DiagnosticCollection, pub(crate) diagnostics: DiagnosticCollection,
pub proc_macro_client: ProcMacroClient, pub(crate) proc_macro_client: ProcMacroClient,
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
source_root_config: SourceRootConfig, source_root_config: SourceRootConfig,
} }
/// An immutable snapshot of the world's state at a point in time. /// An immutable snapshot of the world's state at a point in time.
pub struct GlobalStateSnapshot { pub(crate) struct GlobalStateSnapshot {
pub config: Config, pub(crate) config: Config,
pub workspaces: Arc<Vec<ProjectWorkspace>>, pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
pub analysis: Analysis, pub(crate) analysis: Analysis,
pub check_fixes: CheckFixes, pub(crate) check_fixes: CheckFixes,
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>, vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
} }
impl GlobalState { impl GlobalState {
pub fn new( pub(crate) fn new(
workspaces: Vec<ProjectWorkspace>, workspaces: Vec<ProjectWorkspace>,
lru_capacity: Option<usize>, lru_capacity: Option<usize>,
config: Config, config: Config,
@ -241,7 +241,7 @@ impl GlobalStateSnapshot {
self.vfs.read().1[&id] self.vfs.read().1[&id]
} }
pub fn anchored_path(&self, file_id: FileId, path: &str) -> Url { pub(crate) fn anchored_path(&self, file_id: FileId, path: &str) -> Url {
let mut base = self.vfs.read().0.file_path(file_id); let mut base = self.vfs.read().0.file_path(file_id);
base.pop(); base.pop();
let path = base.join(path); let path = base.join(path);
@ -264,7 +264,7 @@ impl GlobalStateSnapshot {
}) })
} }
pub fn status(&self) -> String { pub(crate) fn status(&self) -> String {
let mut buf = String::new(); let mut buf = String::new();
if self.workspaces.is_empty() { if self.workspaces.is_empty() {
buf.push_str("no workspaces\n") buf.push_str("no workspaces\n")
@ -349,7 +349,7 @@ pub(crate) struct SourceRootConfig {
} }
impl SourceRootConfig { impl SourceRootConfig {
pub fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> { pub(crate) fn partition(&self, vfs: &vfs::Vfs) -> Vec<SourceRoot> {
self.fsc self.fsc
.partition(vfs) .partition(vfs)
.into_iter() .into_iter()