Skip to content

Commit 40db744

Browse files
committed
fix build
1 parent 021a90f commit 40db744

File tree

6 files changed

+57
-20
lines changed

6 files changed

+57
-20
lines changed

engine/Cargo.lock

Lines changed: 46 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/language_server/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ indexmap = { workspace = true }
3030
jod-thread = { version = "0.1.2" }
3131
lsp-server = "0.7.6"
3232
lsp-types = "0.95.0"
33+
playground-server.workspace = true
3334
regex = { version = "1.10.2" }
35+
reqwest.workspace = true
3436
rustc-hash = { version = "2.0.0" }
3537
serde = { version = "1.0.197", features = ["derive"] }
3638
serde_json = { version = "1.0.113" }
@@ -80,6 +82,8 @@ futures.workspace = true
8082
tokio-stream = "0.1.17"
8183
tower-http = { version = "0.6.6", features = ["fs", "cors"] }
8284
tower = "0.5"
85+
webbrowser = "1.0.5"
86+
mime_guess = "2.0.5"
8387

8488
[dev-dependencies]
8589
insta = { version = "1.42.1" }

engine/language_server/src/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ impl Server {
182182
global_settings,
183183
&workspaces,
184184
rt.handle().clone(),
185+
args.playground_port,
185186
args.playground_tx.clone(),
186187
client_version,
187188
)?;

engine/language_server/src/server/api/requests/execute_command.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ use std::time::Duration;
22

33
use lsp_server::ErrorCode;
44
use lsp_types::{request, ExecuteCommandParams, MessageType};
5+
use playground_server::{FrontendMessage, PreSendToWasmMessage};
56
use tokio::time::sleep;
6-
#[cfg(feature = "playground-server")]
77
use webbrowser;
88

9-
// use crate::server::api::DocumentKey;
10-
use playground_server::{FrontendMessage, PreSendToWasmMessage};
119
use crate::{
1210
server::{
1311
api::{
@@ -27,7 +25,6 @@ impl RequestHandler for ExecuteCommand {
2725
}
2826

2927
impl SyncRequestHandler for ExecuteCommand {
30-
#[cfg(feature = "playground-server")]
3128
fn run(
3229
session: &mut Session,
3330
notifier: Notifier,
@@ -41,12 +38,9 @@ impl SyncRequestHandler for ExecuteCommand {
4138
// Fall back to configured port if actual port not set yet
4239

4340
use playground_server::{FrontendMessage, PreSendToWasmMessage};
44-
let port = session
45-
.get_session_playground_port()
46-
.unwrap_or_else(|| session.baml_settings.playground_port.unwrap_or(3030));
4741

4842
// Construct the URL
49-
let url = format!("http://localhost:{port}");
43+
let url = format!("http://localhost:{}", session.playground_port);
5044

5145
// Open the browser
5246
if let Err(e) = webbrowser::open(&url) {
@@ -101,16 +95,6 @@ impl SyncRequestHandler for ExecuteCommand {
10195
.unwrap();
10296
}
10397
Ok(RegisteredCommands::RunTest(args)) => {
104-
// session
105-
// .playground_tx
106-
// .send(PreSendToWasmMessage::FrontendMessage(
107-
// FrontendMessage::select_function {
108-
// root_path: args.project_id,
109-
// function_name: args.function_name.clone(),
110-
// },
111-
// ))
112-
// .unwrap();
113-
// std::thread::sleep(std::time::Duration::from_secs(1));
11498
session
11599
.playground_tx
116100
.send(PreSendToWasmMessage::FrontendMessage(

engine/language_server/src/session.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub struct Session {
5656

5757
pub baml_settings: BamlSettings,
5858

59+
pub playground_port: u16,
5960
pub playground_tx: broadcast::Sender<PreSendToWasmMessage>,
6061
}
6162

@@ -67,6 +68,7 @@ impl Clone for Session {
6768
position_encoding: self.position_encoding,
6869
resolved_client_capabilities: self.resolved_client_capabilities.clone(),
6970
baml_settings: self.baml_settings.clone(),
71+
playground_port: self.playground_port,
7072
playground_tx: self.playground_tx.clone(),
7173
}
7274
}
@@ -79,6 +81,7 @@ impl Session {
7981
global_settings: ClientSettings,
8082
workspace_folders: &[(Url, ClientSettings)],
8183
runtime_handle: tokio::runtime::Handle,
84+
playground_port: u16,
8285
playground_tx: broadcast::Sender<PreSendToWasmMessage>,
8386
client_version: Option<String>,
8487
) -> anyhow::Result<Self> {
@@ -128,6 +131,7 @@ impl Session {
128131
tracing::info!("--- Session::new final baml_settings: {:?}", baml_settings);
129132
baml_settings
130133
},
134+
playground_port,
131135
playground_tx,
132136
})
133137
}

engine/language_server/src/session/settings.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ impl BamlSettings {
4242
}
4343
}
4444

45-
4645
fn default_feature_flags() -> Option<Vec<String>> {
4746
Some(vec!["beta".to_string()])
4847
}

0 commit comments

Comments
 (0)