Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not stop reloading docs on error #9870

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,11 @@ fn reload_all(
// Ensure that the view is synced with the document's history.
view.sync_changes(doc);

doc.reload(view, &cx.editor.diff_providers)?;
if let Err(error) = doc.reload(view, &cx.editor.diff_providers) {
cx.editor.set_error(format!("{}", error));
continue;
}

if let Some(path) = doc.path() {
cx.editor
.language_servers
Expand Down
12 changes: 7 additions & 5 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,13 @@ impl Document {
provider_registry: &DiffProviderRegistry,
) -> Result<(), Error> {
let encoding = self.encoding;
let path = self
.path()
.filter(|path| path.exists())
.ok_or_else(|| anyhow!("can't find file to reload from {:?}", self.display_name()))?
.to_owned();
let path = match self.path() {
None => return Ok(()),
Some(path) => match path.exists() {
true => path.to_owned(),
false => bail!("can't find file to reload from {:?}", self.display_name()),
},
};

// Once we have a valid path we check if its readonly status has changed
self.detect_readonly();
Expand Down
Loading