@@ -216,21 +216,17 @@ impl State {
216
216
}
217
217
218
218
fn define_signs ( & mut self ) -> Result < ( ) > {
219
- info ! ( "Define signs" ) ;
220
- let cmd = self . get ( |state| {
221
- let mut cmd = "echo" . to_owned ( ) ;
219
+ info ! ( "Defining signs" ) ;
222
220
223
- for entry in state. diagnosticsDisplay . values ( ) {
224
- cmd += & format ! (
225
- " | execute 'sign define LanguageClient{} text={} texthl={}'" ,
226
- entry. name, entry. signText, entry. signTexthl,
227
- ) ;
228
- }
221
+ let mut cmds = vec ! [ ] ;
222
+ for entry in self . diagnosticsDisplay . values ( ) {
223
+ cmds. push ( format ! (
224
+ "sign define LanguageClient{} text={} texthl={}" ,
225
+ entry. name, entry. signText, entry. signTexthl,
226
+ ) ) ;
227
+ }
229
228
230
- Ok ( cmd)
231
- } ) ?;
232
- self . command ( & cmd) ?;
233
- info ! ( "Define signs" ) ;
229
+ self . command ( cmds) ?;
234
230
Ok ( ( ) )
235
231
}
236
232
@@ -719,9 +715,11 @@ impl State {
719
715
self . text_documents . retain ( |f, _| !f. starts_with ( & root) ) ;
720
716
self . roots . remove ( languageId) ;
721
717
722
- self . call :: < _ , u8 > ( None , "s:ExecuteAutocmd" , "LanguageClientStopped" ) ?;
723
- self . command ( & format ! ( "let {}=0" , VIM__ServerStatus ) ) ?;
724
- self . command ( & format ! ( "let {}=''" , VIM__ServerStatusMessage ) ) ?;
718
+ self . command ( vec ! [
719
+ format!( "let {}=0" , VIM__ServerStatus ) ,
720
+ format!( "let {}=''" , VIM__ServerStatusMessage ) ,
721
+ ] ) ?;
722
+ self . notify ( None , "s:ExecuteAutocmd" , "LanguageClientStopped" ) ?;
725
723
726
724
info ! ( "End cleanup" ) ;
727
725
Ok ( ( ) )
@@ -1819,7 +1817,7 @@ impl State {
1819
1817
}
1820
1818
self . process_diagnostics ( & current_filename, & diagnostics) ?;
1821
1819
self . languageClient_handleCursorMoved ( & json ! ( { } ) . to_params ( ) ?) ?;
1822
- self . call :: < _ , u8 > ( None , "s:ExecuteAutocmd" , "LanguageClientDiagnosticsChanged" ) ?;
1820
+ self . notify ( None , "s:ExecuteAutocmd" , "LanguageClientDiagnosticsChanged" ) ?;
1823
1821
1824
1822
info ! ( "End {}" , lsp:: notification:: PublishDiagnostics :: METHOD ) ;
1825
1823
Ok ( ( ) )
@@ -2513,30 +2511,30 @@ impl State {
2513
2511
2514
2512
pub fn rust_handleBeginBuild ( & mut self , _params : & Option < Params > ) -> Result < ( ) > {
2515
2513
info ! ( "Begin {}" , NOTIFICATION__RustBeginBuild ) ;
2516
- self . command ( & format ! (
2517
- "let {}=1 | let {}='Rust: build begin'" ,
2518
- VIM__ServerStatus , VIM__ServerStatusMessage
2519
- ) ) ?;
2514
+ self . command ( vec ! [
2515
+ format! ( "let {}=1" , VIM__ServerStatus ) ,
2516
+ format! ( "let {}='Rust: build begin'" , VIM__ServerStatusMessage ) ,
2517
+ ] ) ?;
2520
2518
info ! ( "End {}" , NOTIFICATION__RustBeginBuild ) ;
2521
2519
Ok ( ( ) )
2522
2520
}
2523
2521
2524
2522
pub fn rust_handleDiagnosticsBegin ( & mut self , _params : & Option < Params > ) -> Result < ( ) > {
2525
2523
info ! ( "Begin {}" , NOTIFICATION__RustDiagnosticsBegin ) ;
2526
- self . command ( & format ! (
2527
- "let {}=1 | let {}='Rust: diagnostics begin'" ,
2528
- VIM__ServerStatus , VIM__ServerStatusMessage
2529
- ) ) ?;
2524
+ self . command ( vec ! [
2525
+ format! ( "let {}=1" , VIM__ServerStatus ) ,
2526
+ format! ( "let {}='Rust: diagnostics begin'" , VIM__ServerStatusMessage ) ,
2527
+ ] ) ?;
2530
2528
info ! ( "End {}" , NOTIFICATION__RustDiagnosticsBegin ) ;
2531
2529
Ok ( ( ) )
2532
2530
}
2533
2531
2534
2532
pub fn rust_handleDiagnosticsEnd ( & mut self , _params : & Option < Params > ) -> Result < ( ) > {
2535
2533
info ! ( "Begin {}" , NOTIFICATION__RustDiagnosticsEnd ) ;
2536
- self . command ( & format ! (
2537
- "let {}=0 | let {}='Rust: diagnostics end'" ,
2538
- VIM__ServerStatus , VIM__ServerStatusMessage
2539
- ) ) ?;
2534
+ self . command ( vec ! [
2535
+ format! ( "let {}=0" , VIM__ServerStatus ) ,
2536
+ format! ( "let {}='Rust: diagnostics end'" , VIM__ServerStatusMessage ) ,
2537
+ ] ) ?;
2540
2538
info ! ( "End {}" , NOTIFICATION__RustDiagnosticsEnd ) ;
2541
2539
Ok ( ( ) )
2542
2540
}
@@ -2569,13 +2567,14 @@ impl State {
2569
2567
}
2570
2568
}
2571
2569
2572
- self . command ( & format ! (
2573
- "let {}={} | let {}='{}'" ,
2574
- VIM__ServerStatus ,
2575
- if done { 0 } else { 1 } ,
2576
- VIM__ServerStatusMessage ,
2577
- & escape_single_quote( buf)
2578
- ) ) ?;
2570
+ self . command ( vec ! [
2571
+ format!( "let {}={}" , VIM__ServerStatus , if done { 0 } else { 1 } ) ,
2572
+ format!(
2573
+ "let {}='{}'" ,
2574
+ VIM__ServerStatusMessage ,
2575
+ & escape_single_quote( buf)
2576
+ ) ,
2577
+ ] ) ?;
2579
2578
info ! ( "End {}" , NOTIFICATION__WindowProgress ) ;
2580
2579
Ok ( ( ) )
2581
2580
}
@@ -2589,15 +2588,18 @@ impl State {
2589
2588
+ params. onIdMappedCount
2590
2589
+ params. onIndexedCount ;
2591
2590
if total != 0 {
2592
- self . command ( & format ! (
2593
- "let {}=1 | let {}='cquery: indexing ({} jobs)'" ,
2594
- VIM__ServerStatus , VIM__ServerStatusMessage , params. indexRequestCount
2595
- ) ) ?;
2591
+ self . command ( vec ! [
2592
+ format!( "let {}=1" , VIM__ServerStatus ) ,
2593
+ format!(
2594
+ "let {}='cquery: indexing ({} jobs)'" ,
2595
+ VIM__ServerStatusMessage , params. indexRequestCount
2596
+ ) ,
2597
+ ] ) ?;
2596
2598
} else {
2597
- self . command ( & format ! (
2598
- "let {}=0 | let {}='cquery: idle'" ,
2599
- VIM__ServerStatus , VIM__ServerStatusMessage
2600
- ) ) ?;
2599
+ self . command ( vec ! [
2600
+ format! ( "let {}=0" , VIM__ServerStatus ) ,
2601
+ format! ( "let {}='cquery: idle'" , VIM__ServerStatusMessage ) ,
2602
+ ] ) ?;
2601
2603
}
2602
2604
info ! ( "End {}" , NOTIFICATION__CqueryProgress ) ;
2603
2605
Ok ( ( ) )
0 commit comments