From 07eb0090445c22001ba50e71359839250c1b749a Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 26 Feb 2021 09:51:25 -0500 Subject: Improve 'deno lsp' help text (#9610) --- cli/flags.rs | 28 +++++++++++++++------------- cli/main.rs | 4 ++-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cli/flags.rs b/cli/flags.rs index fe88526f4..a803ff63f 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -69,7 +69,7 @@ pub enum DenoSubcommand { root: Option, force: bool, }, - LanguageServer, + Lsp, Lint { files: Vec, ignore: Vec, @@ -331,7 +331,7 @@ pub fn flags_from_vec(args: Vec) -> clap::Result { } else if let Some(m) = matches.subcommand_matches("compile") { compile_parse(&mut flags, m); } else if let Some(m) = matches.subcommand_matches("lsp") { - language_server_parse(&mut flags, m); + lsp_parse(&mut flags, m); } else { repl_parse(&mut flags, &matches); } @@ -389,7 +389,7 @@ If the flag is set, restrict these messages to errors.", .subcommand(fmt_subcommand()) .subcommand(info_subcommand()) .subcommand(install_subcommand()) - .subcommand(language_server_subcommand()) + .subcommand(lsp_subcommand()) .subcommand(lint_subcommand()) .subcommand(repl_subcommand()) .subcommand(run_subcommand()) @@ -782,8 +782,8 @@ fn doc_parse(flags: &mut Flags, matches: &clap::ArgMatches) { }; } -fn language_server_parse(flags: &mut Flags, _matches: &clap::ArgMatches) { - flags.subcommand = DenoSubcommand::LanguageServer; +fn lsp_parse(flags: &mut Flags, _matches: &clap::ArgMatches) { + flags.subcommand = DenoSubcommand::Lsp; } fn lint_parse(flags: &mut Flags, matches: &clap::ArgMatches) { @@ -1288,15 +1288,17 @@ Show documentation for runtime built-ins: ) } -fn language_server_subcommand<'a, 'b>() -> App<'a, 'b> { +fn lsp_subcommand<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("lsp") .about("Start the language server") .long_about( - r#"Start the Deno language server which will take input -from stdin and provide output to stdout. - deno lsp -"#, - ) + "The 'deno lsp' subcommand provides a way for code editors and IDEs to +interact with Deno using the Language Server Protocol. Usually humans do not +use this subcommand directly. For example, 'deno lsp' can provide IDEs with +go-to-definition support and automatic code formatting. + +How to connect various editors and IDEs to 'deno lsp': +https://deno.land/manual/getting_started/setup_your_environment#editors-and-ides") } fn lint_subcommand<'a, 'b>() -> App<'a, 'b> { @@ -2186,12 +2188,12 @@ mod tests { } #[test] - fn language_server() { + fn lsp() { let r = flags_from_vec(svec!["deno", "lsp"]); assert_eq!( r.unwrap(), Flags { - subcommand: DenoSubcommand::LanguageServer, + subcommand: DenoSubcommand::Lsp, ..Flags::default() } ); diff --git a/cli/main.rs b/cli/main.rs index 7071d775a..00f91a77d 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -417,7 +417,7 @@ async fn install_command( tools::installer::install(flags, &module_url, args, name, root, force) } -async fn language_server_command() -> Result<(), AnyError> { +async fn lsp_command() -> Result<(), AnyError> { lsp::start().await } @@ -1099,7 +1099,7 @@ fn get_subcommand( } => { install_command(flags, module_url, args, name, root, force).boxed_local() } - DenoSubcommand::LanguageServer => language_server_command().boxed_local(), + DenoSubcommand::Lsp => lsp_command().boxed_local(), DenoSubcommand::Lint { files, rules, -- cgit v1.2.3