diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-06-22 21:48:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 21:48:01 -0400 |
commit | 477273085f8e5f578ea3ee12c2183c44133af05d (patch) | |
tree | 3d38c3fb69d4dc71f6998810270ff15c5b0a9e8e /cli/lsp | |
parent | 02f7a52235e9db54c5d8cb2015ece0fb1be03362 (diff) |
chore: use lsp to get parent process id (#11083)
Removes the previously added internal `--parent-pid` flag. This solution is better.
Diffstat (limited to 'cli/lsp')
-rw-r--r-- | cli/lsp/language_server.rs | 6 | ||||
-rw-r--r-- | cli/lsp/mod.rs | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 00f49b05d..3e30d2d69 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -39,6 +39,7 @@ use super::diagnostics::DiagnosticSource; use super::documents::DocumentCache; use super::documents::LanguageId; use super::lsp_custom; +use super::parent_process_checker; use super::performance::Performance; use super::registries; use super::sources; @@ -530,6 +531,11 @@ impl Inner { info!("Starting Deno language server..."); let mark = self.performance.mark("initialize", Some(¶ms)); + // exit this process when the parent is lost + if let Some(parent_pid) = params.process_id { + parent_process_checker::start(parent_pid) + } + let capabilities = capabilities::server_capabilities(¶ms.capabilities); let version = format!( diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs index 4723f8b56..c05241ae1 100644 --- a/cli/lsp/mod.rs +++ b/cli/lsp/mod.rs @@ -23,14 +23,10 @@ mod text; mod tsc; mod urls; -pub async fn start(parent_pid: Option<u32>) -> Result<(), AnyError> { +pub async fn start() -> Result<(), AnyError> { let stdin = tokio::io::stdin(); let stdout = tokio::io::stdout(); - if let Some(parent_pid) = parent_pid { - parent_process_checker::start(parent_pid); - } - let (service, messages) = LspService::new(language_server::LanguageServer::new); Server::new(stdin, stdout) |