Display environment loading failures in the activity indicator (#18567)

As @maan2003 noted in #18473, we should warn the user if direnv call
fails

Release Notes:

- Show a notice in the activity indicator if an error occurs while
loading the shell environment
This commit is contained in:
Stanislav Alekseev 2024-10-08 12:36:18 +03:00 committed by GitHub
parent 87cc208f9f
commit 910a773b89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 192 additions and 60 deletions

View file

@ -15,7 +15,9 @@ pub mod worktree_store;
#[cfg(test)]
mod project_tests;
mod direnv;
mod environment;
pub use environment::EnvironmentErrorMessage;
pub mod search_history;
mod yarn;
@ -1185,6 +1187,23 @@ impl Project {
self.environment.read(cx).get_cli_environment()
}
pub fn shell_environment_errors<'a>(
&'a self,
cx: &'a AppContext,
) -> impl Iterator<Item = (&'a WorktreeId, &'a EnvironmentErrorMessage)> {
self.environment.read(cx).environment_errors()
}
pub fn remove_environment_error(
&mut self,
cx: &mut ModelContext<Self>,
worktree_id: WorktreeId,
) {
self.environment.update(cx, |environment, _| {
environment.remove_environment_error(worktree_id);
});
}
#[cfg(any(test, feature = "test-support"))]
pub fn has_open_buffer(&self, path: impl Into<ProjectPath>, cx: &AppContext) -> bool {
self.buffer_store