mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
Improve 'deno lsp' help text (#9610)
This commit is contained in:
parent
67ca978f97
commit
07eb009044
2 changed files with 17 additions and 15 deletions
28
cli/flags.rs
28
cli/flags.rs
|
@ -69,7 +69,7 @@ pub enum DenoSubcommand {
|
||||||
root: Option<PathBuf>,
|
root: Option<PathBuf>,
|
||||||
force: bool,
|
force: bool,
|
||||||
},
|
},
|
||||||
LanguageServer,
|
Lsp,
|
||||||
Lint {
|
Lint {
|
||||||
files: Vec<PathBuf>,
|
files: Vec<PathBuf>,
|
||||||
ignore: Vec<PathBuf>,
|
ignore: Vec<PathBuf>,
|
||||||
|
@ -331,7 +331,7 @@ pub fn flags_from_vec(args: Vec<String>) -> clap::Result<Flags> {
|
||||||
} else if let Some(m) = matches.subcommand_matches("compile") {
|
} else if let Some(m) = matches.subcommand_matches("compile") {
|
||||||
compile_parse(&mut flags, m);
|
compile_parse(&mut flags, m);
|
||||||
} else if let Some(m) = matches.subcommand_matches("lsp") {
|
} else if let Some(m) = matches.subcommand_matches("lsp") {
|
||||||
language_server_parse(&mut flags, m);
|
lsp_parse(&mut flags, m);
|
||||||
} else {
|
} else {
|
||||||
repl_parse(&mut flags, &matches);
|
repl_parse(&mut flags, &matches);
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ If the flag is set, restrict these messages to errors.",
|
||||||
.subcommand(fmt_subcommand())
|
.subcommand(fmt_subcommand())
|
||||||
.subcommand(info_subcommand())
|
.subcommand(info_subcommand())
|
||||||
.subcommand(install_subcommand())
|
.subcommand(install_subcommand())
|
||||||
.subcommand(language_server_subcommand())
|
.subcommand(lsp_subcommand())
|
||||||
.subcommand(lint_subcommand())
|
.subcommand(lint_subcommand())
|
||||||
.subcommand(repl_subcommand())
|
.subcommand(repl_subcommand())
|
||||||
.subcommand(run_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) {
|
fn lsp_parse(flags: &mut Flags, _matches: &clap::ArgMatches) {
|
||||||
flags.subcommand = DenoSubcommand::LanguageServer;
|
flags.subcommand = DenoSubcommand::Lsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lint_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
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")
|
SubCommand::with_name("lsp")
|
||||||
.about("Start the language server")
|
.about("Start the language server")
|
||||||
.long_about(
|
.long_about(
|
||||||
r#"Start the Deno language server which will take input
|
"The 'deno lsp' subcommand provides a way for code editors and IDEs to
|
||||||
from stdin and provide output to stdout.
|
interact with Deno using the Language Server Protocol. Usually humans do not
|
||||||
deno lsp
|
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> {
|
fn lint_subcommand<'a, 'b>() -> App<'a, 'b> {
|
||||||
|
@ -2186,12 +2188,12 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn language_server() {
|
fn lsp() {
|
||||||
let r = flags_from_vec(svec!["deno", "lsp"]);
|
let r = flags_from_vec(svec!["deno", "lsp"]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r.unwrap(),
|
r.unwrap(),
|
||||||
Flags {
|
Flags {
|
||||||
subcommand: DenoSubcommand::LanguageServer,
|
subcommand: DenoSubcommand::Lsp,
|
||||||
..Flags::default()
|
..Flags::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -417,7 +417,7 @@ async fn install_command(
|
||||||
tools::installer::install(flags, &module_url, args, name, root, force)
|
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
|
lsp::start().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@ fn get_subcommand(
|
||||||
} => {
|
} => {
|
||||||
install_command(flags, module_url, args, name, root, force).boxed_local()
|
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 {
|
DenoSubcommand::Lint {
|
||||||
files,
|
files,
|
||||||
rules,
|
rules,
|
||||||
|
|
Loading…
Add table
Reference in a new issue