|
|
|
@ -1917,16 +1917,14 @@ fn append_to_line(cx: &mut Context) {
|
|
|
|
|
|
|
|
|
|
// Creates an LspCallback that waits for formatting changes to be computed. When they're done,
|
|
|
|
|
// it applies them, but only if the doc hasn't changed.
|
|
|
|
|
fn make_format_callback(
|
|
|
|
|
async fn make_format_callback(
|
|
|
|
|
doc_id: DocumentId,
|
|
|
|
|
doc_version: i32,
|
|
|
|
|
set_unmodified: bool,
|
|
|
|
|
format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
|
|
|
|
|
) -> impl Future<Output = anyhow::Result<job::Callback>> {
|
|
|
|
|
async move {
|
|
|
|
|
) -> anyhow::Result<job::Callback> {
|
|
|
|
|
let format = format.await;
|
|
|
|
|
let call: job::Callback =
|
|
|
|
|
Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
|
let call: job::Callback = Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
|
|
|
|
|
let view_id = view!(editor).id;
|
|
|
|
|
if let Some(doc) = editor.document_mut(doc_id) {
|
|
|
|
|
if doc.version() == doc_version {
|
|
|
|
@ -1942,7 +1940,6 @@ fn make_format_callback(
|
|
|
|
|
});
|
|
|
|
|
Ok(call)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum Open {
|
|
|
|
|
Below,
|
|
|
|
|