mirror of https://github.com/helix-editor/helix
Handle workDoneProgress/create request
parent
e1109a5a01
commit
612511dc98
|
@ -316,9 +316,61 @@ impl Application {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Call::MethodCall(call) => {
|
Call::MethodCall(helix_lsp::jsonrpc::MethodCall {
|
||||||
error!("Method not found {}", call.method);
|
method,
|
||||||
|
params,
|
||||||
|
jsonrpc,
|
||||||
|
id,
|
||||||
|
}) => {
|
||||||
|
let call = match MethodCall::parse(&method, params) {
|
||||||
|
Some(call) => call,
|
||||||
|
None => {
|
||||||
|
error!("Method not found {}", method);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
match call {
|
||||||
|
MethodCall::WorkDoneProgressCreate(params) => {
|
||||||
|
self.lsp_progress.create(server_id, params.token);
|
||||||
|
|
||||||
|
let doc = self.editor.documents().find(|doc| {
|
||||||
|
doc.language_server()
|
||||||
|
.map(|server| server.id() == server_id)
|
||||||
|
.unwrap_or_default()
|
||||||
|
});
|
||||||
|
match doc {
|
||||||
|
Some(doc) => {
|
||||||
|
// it's ok to unwrap, we check for the language server before
|
||||||
|
let server = doc.language_server().unwrap();
|
||||||
|
tokio::spawn(server.reply(id, Ok(serde_json::Value::Null)));
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
if let Some(server) =
|
||||||
|
self.editor.language_servers.get_by_id(server_id)
|
||||||
|
{
|
||||||
|
log::warn!(
|
||||||
|
"missing document with language server id `{}`",
|
||||||
|
server_id
|
||||||
|
);
|
||||||
|
tokio::spawn(server.reply(
|
||||||
|
id,
|
||||||
|
Err(helix_lsp::jsonrpc::Error {
|
||||||
|
code: helix_lsp::jsonrpc::ErrorCode::InternalError,
|
||||||
|
message: "document missing".to_string(),
|
||||||
|
data: None,
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
log::warn!(
|
||||||
|
"can't find language server with id `{}`",
|
||||||
|
server_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// self.language_server.reply(
|
// self.language_server.reply(
|
||||||
// call.id,
|
// call.id,
|
||||||
// // TODO: make a Into trait that can cast to Err(jsonrpc::Error)
|
// // TODO: make a Into trait that can cast to Err(jsonrpc::Error)
|
||||||
|
|
Loading…
Reference in New Issue