@@ -250,19 +250,20 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
250
250
}
251
251
} ;
252
252
253
- probe_protocol (
253
+ probe_binary (
254
254
"language server" ,
255
255
lang. language_server
256
256
. as_ref ( )
257
257
. map ( |lsp| lsp. command . to_string ( ) ) ,
258
258
) ?;
259
259
260
- probe_protocol (
260
+ probe_binary (
261
261
"debug adapter" ,
262
262
lang. debugger . as_ref ( ) . map ( |dap| dap. command . to_string ( ) ) ,
263
263
) ?;
264
264
265
- probe_commands (
265
+ probe_binary (
266
+ "formatter" ,
266
267
lang. formatter
267
268
. as_ref ( )
268
269
. map ( |fmtcfg| fmtcfg. command . to_string ( ) ) ,
@@ -275,40 +276,23 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
275
276
Ok ( ( ) )
276
277
}
277
278
278
- /// Display any additional binaries that are configured as commands for the
279
- /// language.
280
- fn probe_commands ( formatter_cmd : Option < String > ) -> std:: io:: Result < ( ) > {
281
- let stdout = std:: io:: stdout ( ) ;
282
- let mut stdout = stdout. lock ( ) ;
283
-
284
- if let Some ( cmd) = formatter_cmd {
285
- let path = match which:: which ( & cmd) {
286
- Ok ( path) => path. display ( ) . to_string ( ) . green ( ) ,
287
- Err ( _) => format ! ( "'{}' not found in $PATH" , cmd) . red ( ) ,
288
- } ;
289
- writeln ! ( stdout, "Binary for formatter: {}" , path) ?;
290
- }
291
-
292
- Ok ( ( ) )
293
- }
294
-
295
- /// Display diagnostics about LSP and DAP.
296
- fn probe_protocol ( protocol_name : & str , server_cmd : Option < String > ) -> std:: io:: Result < ( ) > {
279
+ /// Display diagnostics about binaries related to the language.
280
+ fn probe_binary ( use_case : & str , server_cmd : Option < String > ) -> std:: io:: Result < ( ) > {
297
281
let stdout = std:: io:: stdout ( ) ;
298
282
let mut stdout = stdout. lock ( ) ;
299
283
300
284
let cmd_name = match server_cmd {
301
285
Some ( ref cmd) => cmd. as_str ( ) . green ( ) ,
302
286
None => "None" . yellow ( ) ,
303
287
} ;
304
- writeln ! ( stdout, "Configured {}: {}" , protocol_name , cmd_name) ?;
288
+ writeln ! ( stdout, "Configured {}: {}" , use_case , cmd_name) ?;
305
289
306
290
if let Some ( cmd) = server_cmd {
307
291
let path = match which:: which ( & cmd) {
308
292
Ok ( path) => path. display ( ) . to_string ( ) . green ( ) ,
309
293
Err ( _) => format ! ( "'{}' not found in $PATH" , cmd) . red ( ) ,
310
294
} ;
311
- writeln ! ( stdout, "Binary for {}: {}" , protocol_name , path) ?;
295
+ writeln ! ( stdout, "Binary for {}: {}" , use_case , path) ?;
312
296
}
313
297
314
298
Ok ( ( ) )
0 commit comments