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 {
734734 write ! (
735735 f,
736736 "invalid config value{}:\n {}" ,
737- self . errors. len( ) ,
738737 if self . errors. len( ) == 1 { "" } else { "s" } ,
739738 errors
740739 )
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ pub(crate) struct GlobalState {
7575 pub ( crate ) flycheck : Arc < [ FlycheckHandle ] > ,
7676 pub ( crate ) flycheck_sender : Sender < flycheck:: Message > ,
7777 pub ( crate ) flycheck_receiver : Receiver < flycheck:: Message > ,
78+ pub ( crate ) last_flycheck_error : Option < String > ,
7879
7980 // VFS
8081 pub ( crate ) loader : Handle < Box < dyn vfs:: loader:: Handle > , Receiver < vfs:: loader:: Message > > ,
@@ -179,6 +180,7 @@ impl GlobalState {
179180 flycheck : Arc :: from ( Vec :: new ( ) ) ,
180181 flycheck_sender,
181182 flycheck_receiver,
183+ last_flycheck_error : None ,
182184
183185 vfs : Arc :: new ( RwLock :: new ( ( vfs:: Vfs :: default ( ) , IntMap :: default ( ) ) ) ) ,
184186 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(
169169 // Note that json can be null according to the spec if the client can't
170170 // provide a configuration. This is handled in Config::update below.
171171 let mut config = Config :: clone ( & * this. config ) ;
172- config. update ( json. take ( ) ) ;
172+ this . config_errors = config. update ( json. take ( ) ) . err ( ) ;
173173 this. update_configuration ( config) ;
174174 }
175175 }
Original file line number Diff line number Diff line change @@ -602,21 +602,18 @@ impl GlobalState {
602602 ( Progress :: Begin , None )
603603 }
604604 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+ }
606609 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}" ) ) ;
611612 return ;
612613 }
613614 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}" ) ) ;
620617 ( Progress :: End , None )
621618 }
622619 } ;
Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ impl GlobalState {
139139 status. health = lsp_ext:: Health :: Warning ;
140140 format_to ! ( message, "{err}\n " ) ;
141141 }
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+ }
142147
143148 for ws in self . workspaces . iter ( ) {
144149 let ( ProjectWorkspace :: Cargo { sysroot, .. }
You can’t perform that action at this time.
0 commit comments