@@ -5,7 +5,7 @@ use crate::{
55
66type Result<T> = core::result::Result<T, Error>;
77
8−use helix_core::{ChangeSet, Rope, RopeSlice, Transaction};
8+use helix_core::{ChangeSet, Rope};
99
1010// use std::collections::HashMap;
1111use std::sync::atomic::{AtomicU64, Ordering};
@@ -18,13 +18,12 @@ use smol::{
1818 channel::{Receiver, Sender},
1919 io::{BufReader, BufWriter},
2020 // prelude::*,
21− process::{Child, ChildStderr, Command, Stdio},
21+ process::{Child, Command, Stdio},
2222 Executor,
2323};
2424
2525pub struct Client {
2626 _process: Child,
27− stderr: BufReader<ChildStderr>,
2827
2928 outgoing: Sender<Payload>,
3029 // pub incoming: Receiver<Call>,
@@ -51,11 +50,10 @@ impl Client {
5150 let reader = BufReader::new(process.stdout.take().expect("Failed to open stdout"));
5251 let stderr = BufReader::new(process.stderr.take().expect("Failed to open stderr"));
5352
54− let (incoming, outgoing) = Transport::start(ex, reader, writer);
53+ let (incoming, outgoing) = Transport::start(ex, reader, writer, stderr);
5554
5655 let client = Client {
5756 _process: process,
58− stderr,
5957
6058 outgoing,
6159 // incoming,
@@ -76,17 +74,15 @@ impl Client {
7674 jsonrpc::Id::Num(id)
7775 }
7876
79− fn to_params(value: Value) -> Result<jsonrpc::Params> {
77+ fn value_into_params(value: Value) -> jsonrpc::Params {
8078 use jsonrpc::Params;
8179
82− let params = match value {
80+ match value {
8381 Value::Null => Params::None,
8482 Value::Bool(_) | Value::Number(_) | Value::String(_) => Params::Array(vec![value]),
8583 Value::Array(vec) => Params::Array(vec),
8684 Value::Object(map) => Params::Map(map),
87− };
88−
89− Ok(params)
85+ }
9086 }
9187
9288 /// Execute a RPC request on the language server.
@@ -101,7 +97,7 @@ impl Client {
10197 jsonrpc: Some(jsonrpc::Version::V2),
10298 id: self.next_request_id(),
10399 method: R::METHOD.to_string(),
104− params: Self::to_params(params)?,
100+ params: Self::value_into_params(params),
105101 };
106102
107103 let (tx, rx) = smol::channel::bounded::<Result<Value>>(1);
@@ -143,7 +139,7 @@ impl Client {
143139 let notification = jsonrpc::Notification {
144140 jsonrpc: Some(jsonrpc::Version::V2),
145141 method: R::METHOD.to_string(),
146− params: Self::to_params(params)?,
142+ params: Self::value_into_params(params),
147143 };
148144
149145 self.outgoing
@@ -251,7 +247,7 @@ impl Client {
251247 .await
252248 }
253249
254− fn to_changes(
250+ fn changeset_to_changes(
255251 old_text: &Rope,
256252 changeset: &ChangeSet,
257253 ) -> Vec<lsp::TextDocumentContentChangeEvent> {
@@ -346,7 +342,7 @@ impl Client {
346342 text: "".to_string(),
347343 }] // TODO: probably need old_state here too?
348344 }
349− lsp::TextDocumentSyncKind::Incremental => Self::to_changes(old_text, changes),
345+ lsp::TextDocumentSyncKind::Incremental => Self::changeset_to_changes(old_text, changes),
350346 lsp::TextDocumentSyncKind::None => return Ok(()),
351347 };
352348