Skip to content

Commit b6dad04

Browse files
committed
fix build
1 parent 8fd8e30 commit b6dad04

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

engine/language_server/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub fn run_server() -> anyhow::Result<()> {
8585
Server::new(
8686
worker_threads,
8787
ServerArgs {
88-
tokio_handle: tokio_runtime.handle().clone(),
88+
tokio_runtime,
8989
broadcast_tx,
9090
playground_rx,
9191
playground_tx: playground_tx.clone(),

engine/language_server/src/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use crate::message::try_show_message;
4747
pub type Result<T> = std::result::Result<T, api::Error>;
4848

4949
pub(crate) struct ServerArgs {
50-
pub tokio_handle: tokio::runtime::Handle,
50+
pub tokio_runtime: tokio::runtime::Runtime,
5151
pub broadcast_tx: broadcast::Sender<LangServerToWasmMessage>,
5252
pub playground_rx: broadcast::Receiver<PreLangServerToWasmMessage>,
5353
pub playground_tx: broadcast::Sender<PreLangServerToWasmMessage>,
@@ -195,7 +195,7 @@ impl Server {
195195
{
196196
let lsp_sender = server.connection.make_sender();
197197
let playground_tx = server.session.playground_tx.clone();
198-
server.args.tokio_handle.spawn(async move {
198+
server.args.tokio_runtime.spawn(async move {
199199
lsp_sender
200200
.send(Message::Notification(lsp_server::Notification::new(
201201
"baml/port".to_string(),
@@ -211,7 +211,7 @@ impl Server {
211211
let mut playground_rx = server.args.playground_rx.resubscribe();
212212
let broadcast_tx = server.args.broadcast_tx.clone();
213213
let session = server.session.clone();
214-
server.args.tokio_handle.spawn(async move {
214+
server.args.tokio_runtime.spawn(async move {
215215
tracing::info!("Starting playground rx loop");
216216
while let Ok(msg) = playground_rx.recv().await {
217217
tracing::info!("playground rx loop: {:?}", msg);

engine/language_server/src/tests.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ use crossbeam_channel::{Receiver, Sender};
44
use log::LevelFilter;
55
use lsp_server::Message;
66
use serde_json::json;
7+
use tokio::sync::broadcast;
78

8-
use crate::server::{connection::ConnectionInitializer, Server};
9+
use crate::server::{connection::ConnectionInitializer, Server, ServerArgs};
910

1011
pub struct TestServer {
1112
pub thread_join_handle: thread::JoinHandle<()>,
@@ -126,7 +127,23 @@ pub fn new_test_server(worker_threads: NonZeroUsize) -> anyhow::Result<TestServe
126127
)
127128
.unwrap();
128129

129-
let server = Server::new_with_connection(worker_threads, connection, init_params).unwrap();
130+
let (playground_tx, playground_rx) = broadcast::channel(1);
131+
let (broadcast_tx, _) = broadcast::channel(1);
132+
133+
let server = Server::new_with_connection(
134+
worker_threads,
135+
connection,
136+
init_params,
137+
ServerArgs {
138+
tokio_runtime: tokio::runtime::Runtime::new().unwrap(),
139+
broadcast_tx,
140+
playground_rx,
141+
playground_tx,
142+
playground_port: 0,
143+
proxy_port: 0,
144+
},
145+
)
146+
.unwrap();
130147
server.run().unwrap();
131148
});
132149

0 commit comments

Comments
 (0)