Skip to content

Commit 021a90f

Browse files
committed
cleanup
1 parent 6d9d755 commit 021a90f

File tree

7 files changed

+14
-331
lines changed

7 files changed

+14
-331
lines changed

engine/language_server/src/playground/error_page.html

Lines changed: 0 additions & 245 deletions
This file was deleted.

engine/language_server/src/playground/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

engine/language_server/src/server/api/notifications/did_change.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::{collections::HashMap, time::Instant};
33
use lsp_types::{
44
notification::DidChangeTextDocument, DidChangeTextDocumentParams, PublishDiagnosticsParams,
55
};
6-
76
use playground_server::{FrontendMessage, PreSendToWasmMessage};
87

98
use crate::{
@@ -66,8 +65,6 @@ impl SyncNotificationHandler for DidChangeTextDocumentHandler {
6665
.internal_error()?;
6766

6867
// Broadcast update to playground clients
69-
// #[cfg(feature = "playground-server")]
70-
// if let Some(state) = &session.playground_state {
7168
{
7269
let project = project.lock();
7370
let files_map: std::collections::HashMap<String, String> = project
@@ -96,14 +93,6 @@ impl SyncNotificationHandler for DidChangeTextDocumentHandler {
9693
))
9794
.unwrap();
9895
}
99-
// let root_path = project.root_path().to_string_lossy().to_string();
100-
// let state = state.clone();
101-
// if let Some(runtime) = &session.playground_runtime {
102-
// runtime.spawn(async move {
103-
// let _ = broadcast_project_update(&state, &root_path, files_map).await;
104-
// });
105-
// }
106-
// }
10796

10897
tracing::info!("publishing diagnostics");
10998

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,11 @@ impl SyncRequestHandler for CodeActionHandler {
5555
.find(|f| f.span.file_path == document_key.path().to_string_lossy())
5656
.map(|f| f.name);
5757

58-
// Get the actual playground port from session (determined by server after availability check)
59-
// Fall back to configured port if actual port not set yet
60-
#[cfg(feature = "playground-server")]
61-
let port = session
62-
.get_session_playground_port()
63-
.unwrap_or_else(|| session.baml_settings.playground_port.unwrap_or(3030));
64-
6558
let action = CodeActionOrCommand::CodeAction(CodeAction {
66-
title: format!("Open Playground Localhost:{port}"),
59+
title: "Open Playground".to_string(),
6760
kind: Some(CodeActionKind::EMPTY),
6861
command: Some(Command {
69-
title: format!("Open Playground Localhost:{port}"),
62+
title: "Open Playground".to_string(),
7063
command: "openPlayground".to_string(),
7164
arguments: function_name.map(|name| vec![Value::String(name)]),
7265
}),

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

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use lsp_types::{
44
self, request as req, GotoDefinitionParams, GotoDefinitionResponse, Location, Position, Range,
55
Url,
66
};
7-
// #[cfg(feature = "playground-server")]
8-
// use crate::playground::broadcast_function_change;
97
use playground_server::{FrontendMessage, PreSendToWasmMessage};
108

119
use crate::{
@@ -115,38 +113,19 @@ impl SyncRequestHandler for GotoDefinition {
115113
.into_iter()
116114
.find(|f| f.span.file_path == document_key.path().to_string_lossy())
117115
{
118-
session
119-
.playground_tx
120-
.send(PreSendToWasmMessage::FrontendMessage(
121-
FrontendMessage::select_function {
122-
root_path: guard.root_path().to_string_lossy().to_string(),
123-
function_name: function.name.clone(),
124-
},
125-
))
126-
.unwrap();
116+
if let Err(e) =
117+
session
118+
.playground_tx
119+
.send(PreSendToWasmMessage::FrontendMessage(
120+
FrontendMessage::select_function {
121+
root_path: guard.root_path().to_string_lossy().to_string(),
122+
function_name: function.name.clone(),
123+
},
124+
))
125+
{
126+
tracing::warn!("Error forwarding function change to playground: {}", e);
127+
}
127128
}
128-
// #[cfg(feature = "playground-server")]
129-
// if let Some(state) = &session.playground_state {
130-
// // Get the first function from the current file if available
131-
// if let Some(function) = guard
132-
// .list_functions()
133-
// .unwrap_or_default()
134-
// .into_iter()
135-
// .find(|f| f.span.file_path == document_key.path().to_string_lossy())
136-
// {
137-
// tracing::info!("Broadcasting function change for: {}", function.name);
138-
// let root_path = guard.root_path().to_string_lossy().to_string();
139-
// let state = state.clone();
140-
// let function_name = function.name.clone();
141-
// if let Some(runtime) = &session.playground_runtime {
142-
// runtime.spawn(async move {
143-
// let _ =
144-
// broadcast_function_change(&state, &root_path, function_name)
145-
// .await;
146-
// });
147-
// }
148-
// }
149-
// }
150129

151130
Ok(Some(goto_definition_response))
152131
}

0 commit comments

Comments
 (0)