1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/cli/lsp/mod.rs
David Sherret aecf989d43
chore(lsp): add --parent-pid <pid> flag (#11023)
This commit adds a new `--parent-pid <pid>` flag to `deno lsp` that when provided starts a task that checks for the existence of the provided process id (ex. vscode's) every 30 seconds. If the process doesn't exist (meaning the deno process has nothing interacting with it), then it terminates itself.
2021-06-17 19:57:58 -04:00

42 lines
875 B
Rust

// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::error::AnyError;
use lspower::LspService;
use lspower::Server;
mod analysis;
mod capabilities;
mod code_lens;
mod completions;
mod config;
mod diagnostics;
mod documents;
pub(crate) mod language_server;
mod lsp_custom;
mod parent_process_checker;
mod path_to_regex;
mod performance;
mod registries;
mod semantic_tokens;
mod sources;
mod text;
mod tsc;
mod urls;
pub async fn start(parent_pid: Option<u32>) -> 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)
.interleave(messages)
.serve(service)
.await;
Ok(())
}