mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Tweak visibility
This commit is contained in:
parent
012a7e57b9
commit
10ee6eb733
6 changed files with 84 additions and 88 deletions
|
@ -60,7 +60,6 @@ impl Default for Status {
|
|||
/// incremental salsa database.
|
||||
pub(crate) struct GlobalState {
|
||||
pub(crate) config: Config,
|
||||
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||
pub(crate) analysis_host: AnalysisHost,
|
||||
pub(crate) loader: Box<dyn vfs::loader::Handle>,
|
||||
pub(crate) task_receiver: Receiver<vfs::loader::Message>,
|
||||
|
@ -70,19 +69,20 @@ pub(crate) struct GlobalState {
|
|||
pub(crate) vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
|
||||
pub(crate) status: Status,
|
||||
pub(crate) req_queue: ReqQueue,
|
||||
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
|
||||
latest_requests: Arc<RwLock<LatestRequests>>,
|
||||
source_root_config: SourceRootConfig,
|
||||
_proc_macro_client: ProcMacroClient,
|
||||
workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||
}
|
||||
|
||||
/// An immutable snapshot of the world's state at a point in time.
|
||||
pub(crate) struct GlobalStateSnapshot {
|
||||
pub(crate) config: Config,
|
||||
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||
pub(crate) analysis: Analysis,
|
||||
pub(crate) check_fixes: CheckFixes,
|
||||
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
|
||||
vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
|
||||
workspaces: Arc<Vec<ProjectWorkspace>>,
|
||||
}
|
||||
|
||||
impl GlobalState {
|
||||
|
@ -149,7 +149,6 @@ impl GlobalState {
|
|||
analysis_host.apply_change(change);
|
||||
let mut res = GlobalState {
|
||||
config,
|
||||
workspaces: Arc::new(workspaces),
|
||||
analysis_host,
|
||||
loader,
|
||||
task_receiver,
|
||||
|
@ -162,6 +161,7 @@ impl GlobalState {
|
|||
latest_requests: Default::default(),
|
||||
source_root_config: project_folders.source_root_config,
|
||||
_proc_macro_client: proc_macro_client,
|
||||
workspaces: Arc::new(workspaces),
|
||||
};
|
||||
res.process_changes();
|
||||
res
|
||||
|
@ -240,10 +240,6 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
impl GlobalStateSnapshot {
|
||||
pub(crate) fn analysis(&self) -> &Analysis {
|
||||
&self.analysis
|
||||
}
|
||||
|
||||
pub(crate) fn url_to_file_id(&self, url: &Url) -> Result<FileId> {
|
||||
let path = from_proto::abs_path(url)?;
|
||||
let path = path.into();
|
||||
|
@ -272,7 +268,7 @@ impl GlobalStateSnapshot {
|
|||
&self,
|
||||
crate_id: CrateId,
|
||||
) -> Option<(&CargoWorkspace, Target)> {
|
||||
let file_id = self.analysis().crate_root(crate_id).ok()?;
|
||||
let file_id = self.analysis.crate_root(crate_id).ok()?;
|
||||
let path = self.vfs.read().0.file_path(file_id);
|
||||
let path = path.as_path()?;
|
||||
self.workspaces.iter().find_map(|ws| match ws {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue