File tree Expand file tree Collapse file tree 5 files changed +16
-13
lines changed Expand file tree Collapse file tree 5 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -734,7 +734,6 @@ impl fmt::Display for ConfigError {
734
734
write!(
735
735
f,
736
736
"invalid config value{}:\n{}",
737
- self.errors.len(),
738
737
if self.errors.len() == 1 { "" } else { "s" },
739
738
errors
740
739
)
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ pub(crate) struct GlobalState {
75
75
pub(crate) flycheck: Arc<[FlycheckHandle]>,
76
76
pub(crate) flycheck_sender: Sender<flycheck::Message>,
77
77
pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
78
+ pub(crate) last_flycheck_error: Option<String>,
78
79
79
80
// VFS
80
81
pub(crate) loader: Handle<Box<dyn vfs::loader::Handle>, Receiver<vfs::loader::Message>>,
@@ -179,6 +180,7 @@ impl GlobalState {
179
180
flycheck: Arc::from(Vec::new()),
180
181
flycheck_sender,
181
182
flycheck_receiver,
183
+ last_flycheck_error: None,
182
184
183
185
vfs: Arc::new(RwLock::new((vfs::Vfs::default(), IntMap::default()))),
184
186
vfs_config_version: 0,
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ pub(crate) fn handle_did_change_configuration(
169
169
// Note that json can be null according to the spec if the client can't
170
170
// provide a configuration. This is handled in Config::update below.
171
171
let mut config = Config::clone(&*this.config);
172
- config.update(json.take());
172
+ this.config_errors = config.update(json.take()).err( );
173
173
this.update_configuration(config);
174
174
}
175
175
}
Original file line number Diff line number Diff line change @@ -602,21 +602,18 @@ impl GlobalState {
602
602
(Progress::Begin, None)
603
603
}
604
604
flycheck::Progress::DidCheckCrate(target) => (Progress::Report, Some(target)),
605
- flycheck::Progress::DidCancel => (Progress::End, None),
605
+ flycheck::Progress::DidCancel => {
606
+ self.last_flycheck_error = None;
607
+ (Progress::End, None)
608
+ }
606
609
flycheck::Progress::DidFailToRestart(err) => {
607
- self.show_and_log_error(
608
- "cargo check failed to start".to_string(),
609
- Some(err),
610
- );
610
+ self.last_flycheck_error =
611
+ Some(format!("cargo check failed to start: {err}"));
611
612
return;
612
613
}
613
614
flycheck::Progress::DidFinish(result) => {
614
- if let Err(err) = result {
615
- self.show_and_log_error(
616
- "cargo check failed".to_string(),
617
- Some(err.to_string()),
618
- );
619
- }
615
+ self.last_flycheck_error =
616
+ result.err().map(|err| format!("cargo check failed to start: {err}"));
620
617
(Progress::End, None)
621
618
}
622
619
};
Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ impl GlobalState {
139
139
status.health = lsp_ext::Health::Warning;
140
140
format_to!(message, "{err}\n");
141
141
}
142
+ if let Some(err) = &self.last_flycheck_error {
143
+ status.health = lsp_ext::Health::Warning;
144
+ message.push_str(err);
145
+ message.push('\n');
146
+ }
142
147
143
148
for ws in self.workspaces.iter() {
144
149
let (ProjectWorkspace::Cargo { sysroot, .. }
You can’t perform that action at this time.
0 commit comments