mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-07-07 20:55:02 +00:00
print warning when trying to run serve command in TTY (#155)
Some checks failed
lint / pre-commit (push) Has been cancelled
lint / rustfmt (push) Has been cancelled
lint / clippy (push) Has been cancelled
lint / cargo-check (push) Has been cancelled
release / build (push) Has been cancelled
release / test (push) Has been cancelled
test / generate-matrix (push) Has been cancelled
zizmor 🌈 / zizmor latest via PyPI (push) Has been cancelled
release / release (push) Has been cancelled
test / Python , Django () (push) Has been cancelled
test / tests (push) Has been cancelled
Some checks failed
lint / pre-commit (push) Has been cancelled
lint / rustfmt (push) Has been cancelled
lint / clippy (push) Has been cancelled
lint / cargo-check (push) Has been cancelled
release / build (push) Has been cancelled
release / test (push) Has been cancelled
test / generate-matrix (push) Has been cancelled
zizmor 🌈 / zizmor latest via PyPI (push) Has been cancelled
release / release (push) Has been cancelled
test / Python , Django () (push) Has been cancelled
test / tests (push) Has been cancelled
This commit is contained in:
parent
b71dfe5eb7
commit
68ea842821
1 changed files with 24 additions and 0 deletions
|
@ -6,6 +6,8 @@ mod server;
|
|||
mod session;
|
||||
mod workspace;
|
||||
|
||||
use std::io::IsTerminal;
|
||||
|
||||
use anyhow::Result;
|
||||
use tower_lsp_server::LspService;
|
||||
use tower_lsp_server::Server;
|
||||
|
@ -13,6 +15,28 @@ use tower_lsp_server::Server;
|
|||
use crate::server::DjangoLanguageServer;
|
||||
|
||||
pub fn run() -> Result<()> {
|
||||
if std::io::stdin().is_terminal() {
|
||||
eprintln!(
|
||||
"---------------------------------------------------------------------------------"
|
||||
);
|
||||
eprintln!("Django Language Server is running directly in a terminal.");
|
||||
eprintln!(
|
||||
"This server is designed to communicate over stdin/stdout with a language client."
|
||||
);
|
||||
eprintln!("It is not intended to be used directly in a terminal.");
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
"Note: The server is now waiting for LSP messages, but since you're in a terminal,"
|
||||
);
|
||||
eprintln!("no editor is connected and the server won't do anything.");
|
||||
eprintln!();
|
||||
eprintln!("To exit: Press ENTER to send invalid input and trigger an error exit.");
|
||||
eprintln!("Ctrl+C will not work as expected due to LSP stdio communication.");
|
||||
eprintln!(
|
||||
"---------------------------------------------------------------------------------"
|
||||
);
|
||||
}
|
||||
|
||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue