1
1
mirror of https://github.com/oxalica/nil.git synced 2024-11-22 11:22:46 +03:00

Only enable ClientProcessMonitorLayer for Linux

This commit is contained in:
oxalica 2023-04-18 03:36:03 +08:00
parent a22c8d85a4
commit 263b82c6d2

View File

@ -8,7 +8,6 @@ mod server;
mod vfs; mod vfs;
use anyhow::Result; use anyhow::Result;
use async_lsp::client_monitor::ClientProcessMonitorLayer;
use async_lsp::concurrency::ConcurrencyLayer; use async_lsp::concurrency::ConcurrencyLayer;
use async_lsp::server::LifecycleLayer; use async_lsp::server::LifecycleLayer;
use async_lsp::stdio::{PipeStdin, PipeStdout}; use async_lsp::stdio::{PipeStdin, PipeStdout};
@ -83,13 +82,16 @@ pub async fn run_server_stdio() -> Result<()> {
} }
let (frontend, _) = async_lsp::Frontend::new_server(|client| { let (frontend, _) = async_lsp::Frontend::new_server(|client| {
ServiceBuilder::new() let b = ServiceBuilder::new()
.layer(TracingLayer::default()) .layer(TracingLayer::default())
.layer(LifecycleLayer) .layer(LifecycleLayer)
// TODO: Use `CatchUnwindLayer`. // TODO: Use `CatchUnwindLayer`.
.layer(ConcurrencyLayer::new(concurrency)) .layer(ConcurrencyLayer::new(concurrency));
.layer(ClientProcessMonitorLayer::new(client.clone())) #[cfg(target_os = "linux")]
.service(Server::new_router(client, init_messages)) let b = b.layer(async_lsp::client_monitor::ClientProcessMonitorLayer::new(
client.clone(),
));
b.service(Server::new_router(client, init_messages))
}); });
let input = BufReader::new(tokio::io::stdin()); let input = BufReader::new(tokio::io::stdin());