Debian Codegraph @

debian/patches/2003_avoid_sonic_rs.patch

raw symbols SCIP
1 Description: avoid not-in-Debian crate sonic-rs
2 This essentially reverts upstream git commit e4c5388
3 Author: Jonas Smedegaard <[email protected]>
4 Forwarded: not-needed
5 Last-Update: 2025-12-08
6 ---
7 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8 --- a/Cargo.toml
9 +++ b/Cargo.toml
10 @@ -53,7 +53,6 @@
11 tokio-stream = "0.1.18"
12 toml = "1.1"
13 termina = "0.3"
14 -sonic-rs = "0.5"
15 globset = "0.4"
16 etcetera = "0.11"
17 arc-swap = "1.9"
18 --- a/helix-dap/Cargo.toml
19 +++ b/helix-dap/Cargo.toml
20 @@ -28,4 +28,3 @@
21 futures-executor.workspace = true
22 futures-util.workspace = true
23 tokio-stream.workspace = true
24 -sonic-rs.workspace = true
25 --- a/helix-dap/src/lib.rs
26 +++ b/helix-dap/src/lib.rs
27 @@ -13,7 +13,7 @@
28 #[derive(Error, Debug)]
29 pub enum Error {
30 #[error("failed to parse: {0}")]
31 - Parse(Box<dyn std::error::Error + Send + Sync>),
32 + Parse(#[from] serde_json::Error),
33 #[error("IO Error: {0}")]
34 IO(#[from] std::io::Error),
35 #[error("request {0} timed out")]
36 @@ -29,18 +29,6 @@
37 }
38 pub type Result<T> = core::result::Result<T, Error>;
39
40 -impl From<serde_json::Error> for Error {
41 - fn from(value: serde_json::Error) -> Self {
42 - Self::Parse(Box::new(value))
43 - }
44 -}
45 -
46 -impl From<sonic_rs::Error> for Error {
47 - fn from(value: sonic_rs::Error) -> Self {
48 - Self::Parse(Box::new(value))
49 - }
50 -}
51 -
52 #[derive(Debug)]
53 pub enum Request {
54 RunInTerminal(<requests::RunInTerminal as helix_dap_types::Request>::Arguments),
55 --- a/helix-dap/src/transport.rs
56 +++ b/helix-dap/src/transport.rs
57 @@ -125,14 +125,12 @@
58
59 info!("[{}] <- DAP {}", id, msg);
60
61 - // NOTE: We avoid using `?` here, since it would return early on error
62 - // and skip clearing `content`. By returning the result directly instead,
63 - // we ensure `content.clear()` is always called.
64 - let output = sonic_rs::from_slice(content).map_err(Into::into);
65 + // try parsing as output (server response) or call (server request)
66 + let output: serde_json::Result<Payload> = serde_json::from_str(msg);
67
68 content.clear();
69
70 - output
71 + Ok(output?)
72 }
73
74 async fn recv_server_error(
75 --- a/helix-lsp/Cargo.toml
76 +++ b/helix-lsp/Cargo.toml
77 @@ -32,4 +32,3 @@
78 arc-swap = "1"
79 slotmap.workspace = true
80 thiserror.workspace = true
81 -sonic-rs.workspace = true
82 --- a/helix-lsp/src/lib.rs
83 +++ b/helix-lsp/src/lib.rs
84 @@ -39,7 +39,7 @@
85 #[error("protocol error: {0}")]
86 Rpc(#[from] jsonrpc::Error),
87 #[error("failed to parse: {0}")]
88 - Parse(Box<dyn std::error::Error + Send + Sync>),
89 + Parse(#[from] serde_json::Error),
90 #[error("IO Error: {0}")]
91 IO(#[from] std::io::Error),
92 #[error("request {0} timed out")]
93 @@ -54,18 +54,6 @@
94 Other(#[from] anyhow::Error),
95 }
96
97 -impl From<serde_json::Error> for Error {
98 - fn from(value: serde_json::Error) -> Self {
99 - Self::Parse(Box::new(value))
100 - }
101 -}
102 -
103 -impl From<sonic_rs::Error> for Error {
104 - fn from(value: sonic_rs::Error) -> Self {
105 - Self::Parse(Box::new(value))
106 - }
107 -}
108 -
109 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
110 pub enum OffsetEncoding {
111 /// UTF-8 code units aka bytes
112 --- a/helix-lsp/src/transport.rs
113 +++ b/helix-lsp/src/transport.rs
114 @@ -111,7 +111,7 @@
115 buffer.clear();
116 if reader.read_line(buffer).await? == 0 {
117 return Err(Error::StreamClosed);
118 - }
119 + };
120
121 // debug!("<- header {:?}", buffer);
122
123 @@ -146,14 +146,12 @@
124
125 info!("{language_server_name} <- {msg}");
126
127 - // NOTE: We avoid using `?` here, since it would return early on error
128 - // and skip clearing `content`. By returning the result directly instead,
129 - // we ensure `content.clear()` is always called.
130 - let output = sonic_rs::from_slice(content).map_err(Into::into);
131 + // try parsing as output (server response) or call (server request)
132 + let output: serde_json::Result<ServerMessage> = serde_json::from_str(msg);
133
134 content.clear();
135
136 - output
137 + Ok(output?)
138 }
139
140 async fn recv_server_error(