summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-10-07 17:45:50 +0100
committerGitHub <noreply@github.com>2024-10-07 16:45:50 +0000
commit719b8dcfde074e2347f0305bd2dec170fd9c4b04 (patch)
treec4b3ec28ef92f5bf918304d2c679fb579531554b /cli/main.rs
parentfc293c68b5e08f5e2cf766cf9356cb42c904a3ca (diff)
feat(lsp): add a message when someone runs 'deno lsp' manually (#26051)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 93bd97e2a..ddb6078af 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -57,6 +57,7 @@ use standalone::MODULE_NOT_FOUND;
use standalone::UNSUPPORTED_SCHEME;
use std::env;
use std::future::Future;
+use std::io::IsTerminal;
use std::ops::Deref;
use std::path::PathBuf;
use std::sync::Arc;
@@ -161,7 +162,19 @@ async fn run_subcommand(flags: Arc<Flags>) -> Result<i32, AnyError> {
DenoSubcommand::Uninstall(uninstall_flags) => spawn_subcommand(async {
tools::installer::uninstall(flags, uninstall_flags).await
}),
- DenoSubcommand::Lsp => spawn_subcommand(async { lsp::start().await }),
+ DenoSubcommand::Lsp => spawn_subcommand(async {
+ if std::io::stderr().is_terminal() {
+ log::warn!(
+ "{} command is intended to be run by text editors and IDEs and shouldn't be run manually.
+
+ Visit https://docs.deno.com/runtime/getting_started/setup_your_environment/ for instruction
+ how to setup your favorite text editor.
+
+ Press Ctrl+C to exit.
+ ", colors::cyan("deno lsp"));
+ }
+ lsp::start().await
+ }),
DenoSubcommand::Lint(lint_flags) => spawn_subcommand(async {
if lint_flags.rules {
tools::lint::print_rules_list(