|
|
@ -1047,20 +1047,31 @@ impl Application {
|
|
|
|
Ok(serde_json::Value::Null)
|
|
|
|
Ok(serde_json::Value::Null)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(MethodCall::ApplyWorkspaceEdit(params)) => {
|
|
|
|
Ok(MethodCall::ApplyWorkspaceEdit(params)) => {
|
|
|
|
let res = apply_workspace_edit(
|
|
|
|
let language_server = language_server!();
|
|
|
|
&mut self.editor,
|
|
|
|
if language_server.is_initialized() {
|
|
|
|
helix_lsp::OffsetEncoding::Utf8,
|
|
|
|
let offset_encoding = language_server.offset_encoding();
|
|
|
|
¶ms.edit,
|
|
|
|
let res = apply_workspace_edit(
|
|
|
|
);
|
|
|
|
&mut self.editor,
|
|
|
|
|
|
|
|
offset_encoding,
|
|
|
|
Ok(json!(lsp::ApplyWorkspaceEditResponse {
|
|
|
|
¶ms.edit,
|
|
|
|
applied: res.is_ok(),
|
|
|
|
);
|
|
|
|
failure_reason: res.as_ref().err().map(|err| err.kind.to_string()),
|
|
|
|
|
|
|
|
failed_change: res
|
|
|
|
Ok(json!(lsp::ApplyWorkspaceEditResponse {
|
|
|
|
.as_ref()
|
|
|
|
applied: res.is_ok(),
|
|
|
|
.err()
|
|
|
|
failure_reason: res.as_ref().err().map(|err| err.kind.to_string()),
|
|
|
|
.map(|err| err.failed_change_idx as u32),
|
|
|
|
failed_change: res
|
|
|
|
}))
|
|
|
|
.as_ref()
|
|
|
|
|
|
|
|
.err()
|
|
|
|
|
|
|
|
.map(|err| err.failed_change_idx as u32),
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Err(helix_lsp::jsonrpc::Error {
|
|
|
|
|
|
|
|
code: helix_lsp::jsonrpc::ErrorCode::InvalidRequest,
|
|
|
|
|
|
|
|
message: "Server must be initialized to request workspace edits"
|
|
|
|
|
|
|
|
.to_string(),
|
|
|
|
|
|
|
|
data: None,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Ok(MethodCall::WorkspaceFolders) => {
|
|
|
|
Ok(MethodCall::WorkspaceFolders) => {
|
|
|
|
Ok(json!(&*language_server!().workspace_folders().await))
|
|
|
|
Ok(json!(&*language_server!().workspace_folders().await))
|
|
|
|