File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,37 @@ mod server;
66mod session;
77mod workspace;
88
9+ use std:: io:: IsTerminal ;
10+
911use anyhow:: Result ;
1012use tower_lsp_server:: LspService ;
1113use tower_lsp_server:: Server ;
1214
1315use crate :: server:: DjangoLanguageServer ;
1416
1517pub fn run ( ) -> Result < ( ) > {
18+ if std:: io:: stdin ( ) . is_terminal ( ) {
19+ eprintln ! (
20+ "---------------------------------------------------------------------------------"
21+ ) ;
22+ eprintln ! ( "Django Language Server is running directly in a terminal." ) ;
23+ eprintln ! (
24+ "This server is designed to communicate over stdin/stdout with a language client."
25+ ) ;
26+ eprintln ! ( "It is not intended to be used directly in a terminal." ) ;
27+ eprintln ! ( ) ;
28+ eprintln ! (
29+ "Note: The server is now waiting for LSP messages, but since you're in a terminal,"
30+ ) ;
31+ eprintln ! ( "no editor is connected and the server won't do anything." ) ;
32+ eprintln ! ( ) ;
33+ eprintln ! ( "To exit: Press ENTER to send invalid input and trigger an error exit." ) ;
34+ eprintln ! ( "Ctrl+C will not work as expected due to LSP stdio communication." ) ;
35+ eprintln ! (
36+ "---------------------------------------------------------------------------------"
37+ ) ;
38+ }
39+
1640 let runtime = tokio:: runtime:: Builder :: new_current_thread ( )
1741 . enable_all ( )
1842 . build ( ) ?;
You can’t perform that action at this time.
0 commit comments