Merge pull request #1747 from zed-industries/fix-clangd-error
Fix error on clangd when `compile-commands.json` is present
This commit is contained in:
commit
26b03afa60
1 changed files with 5 additions and 3 deletions
|
@ -56,7 +56,7 @@ pub struct Subscription {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct Request<'a, T> {
|
struct Request<'a, T> {
|
||||||
jsonrpc: &'a str,
|
jsonrpc: &'static str,
|
||||||
id: usize,
|
id: usize,
|
||||||
method: &'a str,
|
method: &'a str,
|
||||||
params: T,
|
params: T,
|
||||||
|
@ -73,6 +73,7 @@ struct AnyResponse<'a> {
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct Response<T> {
|
struct Response<T> {
|
||||||
|
jsonrpc: &'static str,
|
||||||
id: usize,
|
id: usize,
|
||||||
result: Option<T>,
|
result: Option<T>,
|
||||||
error: Option<Error>,
|
error: Option<Error>,
|
||||||
|
@ -80,8 +81,7 @@ struct Response<T> {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct Notification<'a, T> {
|
struct Notification<'a, T> {
|
||||||
#[serde(borrow)]
|
jsonrpc: &'static str,
|
||||||
jsonrpc: &'a str,
|
|
||||||
#[serde(borrow)]
|
#[serde(borrow)]
|
||||||
method: &'a str,
|
method: &'a str,
|
||||||
params: T,
|
params: T,
|
||||||
|
@ -453,11 +453,13 @@ impl LanguageServer {
|
||||||
async move {
|
async move {
|
||||||
let response = match response.await {
|
let response = match response.await {
|
||||||
Ok(result) => Response {
|
Ok(result) => Response {
|
||||||
|
jsonrpc: JSON_RPC_VERSION,
|
||||||
id,
|
id,
|
||||||
result: Some(result),
|
result: Some(result),
|
||||||
error: None,
|
error: None,
|
||||||
},
|
},
|
||||||
Err(error) => Response {
|
Err(error) => Response {
|
||||||
|
jsonrpc: JSON_RPC_VERSION,
|
||||||
id,
|
id,
|
||||||
result: None,
|
result: None,
|
||||||
error: Some(Error {
|
error: Some(Error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue