Build filesystem JSON params only for remote TUI sessions (#39077)

## Why

In-process app-server filesystem requests use typed protocol requests and do
not need JSON-RPC parameters.

## What changed

Pass remote filesystem parameters to `request_fs_path` as closures and
evaluate them only when the session uses a remote request handle.

GitOrigin-RevId: 623c8733542553d73e2c0e4c4a60d40258bc91c1
This commit is contained in:
Benjamin Carlsson authored and copyberry committed 2026-08-17 20:46:43 +00:00
1 parent 37efa18be2
commit e92627bf7e
1 file changed
+6 -6
+6 -6
View File
@@ -35,7 +35,7 @@ impl AppServerSession {
recursive: Some(true), recursive: Some(true),
}, },
}, },
json!({ "path": path.as_str(), "recursive": true }), || json!({ "path": path.as_str(), "recursive": true }),
) )
.await .await
.map(drop) .map(drop)
@@ -57,7 +57,7 @@ impl AppServerSession {
data_base64: data_base64.clone(), data_base64: data_base64.clone(),
}, },
}, },
json!({ "path": path.as_str(), "dataBase64": data_base64 }), || json!({ "path": path.as_str(), "dataBase64": data_base64 }),
) )
.await .await
.map(drop) .map(drop)
@@ -72,7 +72,7 @@ impl AppServerSession {
request_id, request_id,
params: FsReadFileParams { path }, params: FsReadFileParams { path },
}, },
json!({ "path": path.as_str() }), || json!({ "path": path.as_str() }),
) )
.await?; .await?;
STANDARD STANDARD
@@ -92,7 +92,7 @@ impl AppServerSession {
force: None, force: None,
}, },
}, },
json!({ "path": path.as_str() }), || json!({ "path": path.as_str() }),
) )
.await .await
.map(drop) .map(drop)
@@ -103,7 +103,7 @@ impl AppServerSession {
method: &str, method: &str,
path: &AppServerPath, path: &AppServerPath,
local_request: impl FnOnce(RequestId, AbsolutePathBuf) -> ClientRequest, local_request: impl FnOnce(RequestId, AbsolutePathBuf) -> ClientRequest,
remote_params: serde_json::Value, remote_params: impl FnOnce() -> serde_json::Value,
) -> Result<T> { ) -> Result<T> {
let request_id = self.next_request_id(); let request_id = self.next_request_id();
match self.request_handle() { match self.request_handle() {
@@ -112,7 +112,7 @@ impl AppServerSession {
.request_json_rpc(JSONRPCRequest { .request_json_rpc(JSONRPCRequest {
id: request_id, id: request_id,
method: method.to_string(), method: method.to_string(),
params: Some(remote_params), params: Some(remote_params()),
trace: None, trace: None,
}) })
.await .await