Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit 4a41807

Browse files
committed
cargo fmt
1 parent 5044c1d commit 4a41807

File tree

6 files changed

+162
-110
lines changed

6 files changed

+162
-110
lines changed

server/src/ipc.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ impl IPCCommunicator {
149149
let mut payload = serde_json::to_value(params)?;
150150
{
151151
let inner = self.inner.lock().await;
152-
payload["terminal_shell_pid"] = serde_json::Value::Number(serde_json::Number::from(inner.terminal_shell_pid));
152+
payload["terminal_shell_pid"] =
153+
serde_json::Value::Number(serde_json::Number::from(inner.terminal_shell_pid));
153154
}
154155

155156
let message = IPCMessage {
@@ -253,7 +254,7 @@ impl IPCCommunicator {
253254

254255
// Also send to VSCode extension via IPC for unified logging
255256
let log_params = LogParams { level, message };
256-
257+
257258
// Create message payload with shell PID added for multi-window filtering
258259
let mut payload = match serde_json::to_value(log_params) {
259260
Ok(payload) => payload,
@@ -262,13 +263,14 @@ impl IPCCommunicator {
262263
return;
263264
}
264265
};
265-
266+
266267
// Add shell PID for filtering
267268
{
268269
let inner = self.inner.lock().await;
269-
payload["terminal_shell_pid"] = serde_json::Value::Number(serde_json::Number::from(inner.terminal_shell_pid));
270+
payload["terminal_shell_pid"] =
271+
serde_json::Value::Number(serde_json::Number::from(inner.terminal_shell_pid));
270272
}
271-
273+
272274
let ipc_message = IPCMessage {
273275
message_type: IPCMessageType::Log,
274276
payload,

server/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async fn main() -> Result<()> {
106106

107107
// Create our server instance
108108
let server = DialecticServer::new().await?;
109-
109+
110110
// Clone the IPC communicator for shutdown handling
111111
let ipc_for_shutdown = server.ipc().clone();
112112

@@ -121,7 +121,7 @@ async fn main() -> Result<()> {
121121
service.waiting().await?;
122122

123123
info!("Dialectic MCP Server shutting down");
124-
124+
125125
// Send Goodbye discovery message before shutdown
126126
if let Err(e) = ipc_for_shutdown.shutdown().await {
127127
error!("Error during IPC shutdown: {}", e);

server/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl DialecticServer {
9393
&self,
9494
Parameters(params): Parameters<PresentReviewParams>,
9595
) -> Result<CallToolResult, McpError> {
96-
// ANCHOR_END: present_review_tool
96+
// ANCHOR_END: present_review_tool
9797
// Log the tool call via IPC (also logs locally)
9898
self.ipc
9999
.send_log(

server/src/types.rs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
//! Shared types for Dialectic MCP Server
2-
//!
2+
//!
33
//! Mirrors the TypeScript types from server/src/types.ts to ensure
44
//! protocol compatibility across the IPC boundary.
55
6-
use serde::{Deserialize, Serialize};
76
use schemars::JsonSchema;
7+
use serde::{Deserialize, Serialize};
88

99
/// Parameters for the present-review MCP tool
10-
///
10+
///
1111
/// Matches PresentReviewParams from TypeScript implementation
1212
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
1313
pub struct PresentReviewParams {
1414
/// Markdown content of the review to display
1515
pub content: String,
16-
16+
1717
/// How to handle the review content in the extension
1818
pub mode: ReviewMode,
19-
19+
2020
/// Optional section name for update-section mode
2121
pub section: Option<String>,
22-
22+
2323
/// Base directory path for resolving relative file references
2424
#[serde(rename = "baseUri")]
2525
pub base_uri: String,
@@ -45,7 +45,7 @@ impl Default for ReviewMode {
4545
pub struct PresentReviewResult {
4646
/// Whether the review was successfully presented
4747
pub success: bool,
48-
48+
4949
/// Optional message about the operation
5050
pub message: Option<String>,
5151
}
@@ -55,7 +55,7 @@ pub struct PresentReviewResult {
5555
pub struct LogParams {
5656
/// Log level
5757
pub level: LogLevel,
58-
58+
5959
/// Log message content
6060
pub message: String,
6161
}
@@ -75,39 +75,39 @@ pub struct GetSelectionResult {
7575
/// Currently selected text, null if no selection
7676
#[serde(rename = "selectedText")]
7777
pub selected_text: Option<String>,
78-
78+
7979
/// File path of the active editor, if available
8080
#[serde(rename = "filePath")]
8181
pub file_path: Option<String>,
82-
82+
8383
/// Starting line number (1-based)
8484
#[serde(rename = "startLine")]
8585
pub start_line: Option<u32>,
86-
86+
8787
/// Starting column number (1-based)
8888
#[serde(rename = "startColumn")]
8989
pub start_column: Option<u32>,
90-
90+
9191
/// Ending line number (1-based)
9292
#[serde(rename = "endLine")]
9393
pub end_line: Option<u32>,
94-
94+
9595
/// Ending column number (1-based)
9696
#[serde(rename = "endColumn")]
9797
pub end_column: Option<u32>,
98-
98+
9999
/// Single line number if selection is on one line
100100
#[serde(rename = "lineNumber")]
101101
pub line_number: Option<u32>,
102-
102+
103103
/// Language ID of the document
104104
#[serde(rename = "documentLanguage")]
105105
pub document_language: Option<String>,
106-
106+
107107
/// Whether the document is untitled
108108
#[serde(rename = "isUntitled")]
109109
pub is_untitled: Option<bool>,
110-
110+
111111
/// Message explaining the selection state
112112
pub message: Option<String>,
113113
}
@@ -131,10 +131,10 @@ pub struct GoodbyePayload {
131131
pub struct ResponsePayload {
132132
/// Whether the operation succeeded
133133
pub success: bool,
134-
134+
135135
/// Optional error message
136136
pub error: Option<String>,
137-
137+
138138
/// Optional data payload for responses like get_selection
139139
pub data: Option<serde_json::Value>,
140140
}
@@ -145,10 +145,10 @@ pub struct IPCMessage {
145145
/// Message type identifier
146146
#[serde(rename = "type")]
147147
pub message_type: IPCMessageType,
148-
148+
149149
/// Message payload
150150
pub payload: serde_json::Value,
151-
151+
152152
/// Unique message ID for response tracking
153153
pub id: String,
154154
}
@@ -169,5 +169,3 @@ pub enum IPCMessageType {
169169
/// Response to any message (replaces IPCResponse struct)
170170
Response,
171171
}
172-
173-

server/tests/daemon_integration_tests.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ async fn test_daemon_spawning_integration() {
99

1010
// This test verifies that the MCP server can spawn and connect to the daemon
1111
// We'll use the test mode to avoid requiring actual VSCode PID discovery
12-
12+
1313
let _server = DialecticServer::new_test();
14-
14+
1515
// Verify server was created successfully
1616
assert!(true, "Server created successfully in test mode");
17-
17+
1818
// In test mode, IPC operations are mocked, so we can't test the actual daemon connection
1919
// But we can verify the server initializes without errors
2020
}
2121

2222
#[tokio::test]
2323
async fn test_daemon_ensure_running_separate_process() {
2424
use dialectic_mcp_server::daemon::run_daemon_with_prefix;
25-
use tokio::sync::Barrier;
2625
use std::sync::Arc;
26+
use tokio::sync::Barrier;
2727
use uuid::Uuid;
2828

2929
// Initialize tracing for test output
@@ -52,11 +52,17 @@ async fn test_daemon_ensure_running_separate_process() {
5252
ready_barrier.wait().await;
5353

5454
// Verify socket was created
55-
assert!(std::path::Path::new(&socket_path).exists(), "Daemon should create socket file");
55+
assert!(
56+
std::path::Path::new(&socket_path).exists(),
57+
"Daemon should create socket file"
58+
);
5659

5760
// Verify we can connect to the daemon
5861
let connection_result = tokio::net::UnixStream::connect(&socket_path).await;
59-
assert!(connection_result.is_ok(), "Should be able to connect to daemon");
62+
assert!(
63+
connection_result.is_ok(),
64+
"Should be able to connect to daemon"
65+
);
6066

6167
// Clean up
6268
daemon_handle.abort();

0 commit comments

Comments
 (0)