|
|
@ -2187,7 +2187,7 @@ async fn make_format_callback(
|
|
|
|
format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
|
|
|
|
format: impl Future<Output = helix_lsp::util::LspFormatting> + Send + 'static,
|
|
|
|
) -> anyhow::Result<job::Callback> {
|
|
|
|
) -> anyhow::Result<job::Callback> {
|
|
|
|
let format = format.await;
|
|
|
|
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, _compositor| {
|
|
|
|
let view_id = view!(editor).id;
|
|
|
|
let view_id = view!(editor).id;
|
|
|
|
if let Some(doc) = editor.document_mut(doc_id) {
|
|
|
|
if let Some(doc) = editor.document_mut(doc_id) {
|
|
|
|
if doc.version() == doc_version {
|
|
|
|
if doc.version() == doc_version {
|
|
|
@ -3475,9 +3475,7 @@ pub fn completion(cx: &mut Context) {
|
|
|
|
|
|
|
|
|
|
|
|
cx.callback(
|
|
|
|
cx.callback(
|
|
|
|
future,
|
|
|
|
future,
|
|
|
|
move |editor: &mut Editor,
|
|
|
|
move |editor, compositor, response: Option<lsp::CompletionResponse>| {
|
|
|
|
compositor: &mut Compositor,
|
|
|
|
|
|
|
|
response: Option<lsp::CompletionResponse>| {
|
|
|
|
|
|
|
|
let doc = doc!(editor);
|
|
|
|
let doc = doc!(editor);
|
|
|
|
if doc.mode() != Mode::Insert {
|
|
|
|
if doc.mode() != Mode::Insert {
|
|
|
|
// we're not in insert mode anymore
|
|
|
|
// we're not in insert mode anymore
|
|
|
@ -4123,11 +4121,12 @@ fn shell_append_output(cx: &mut Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn shell_keep_pipe(cx: &mut Context) {
|
|
|
|
fn shell_keep_pipe(cx: &mut Context) {
|
|
|
|
let prompt = Prompt::new(
|
|
|
|
ui::prompt(
|
|
|
|
|
|
|
|
cx,
|
|
|
|
"keep-pipe:".into(),
|
|
|
|
"keep-pipe:".into(),
|
|
|
|
Some('|'),
|
|
|
|
Some('|'),
|
|
|
|
ui::completers::none,
|
|
|
|
ui::completers::none,
|
|
|
|
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
|
|
|
|
move |cx, input: &str, event: PromptEvent| {
|
|
|
|
let shell = &cx.editor.config().shell;
|
|
|
|
let shell = &cx.editor.config().shell;
|
|
|
|
if event != PromptEvent::Validate {
|
|
|
|
if event != PromptEvent::Validate {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -4171,8 +4170,6 @@ fn shell_keep_pipe(cx: &mut Context) {
|
|
|
|
doc.set_selection(view.id, Selection::new(ranges, index));
|
|
|
|
doc.set_selection(view.id, Selection::new(ranges, index));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
cx.push_layer(Box::new(prompt));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn shell_impl(
|
|
|
|
fn shell_impl(
|
|
|
@ -4219,11 +4216,13 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
|
|
|
|
ShellBehavior::Replace | ShellBehavior::Ignore => true,
|
|
|
|
ShellBehavior::Replace | ShellBehavior::Ignore => true,
|
|
|
|
ShellBehavior::Insert | ShellBehavior::Append => false,
|
|
|
|
ShellBehavior::Insert | ShellBehavior::Append => false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let prompt = Prompt::new(
|
|
|
|
|
|
|
|
|
|
|
|
ui::prompt(
|
|
|
|
|
|
|
|
cx,
|
|
|
|
prompt,
|
|
|
|
prompt,
|
|
|
|
Some('|'),
|
|
|
|
Some('|'),
|
|
|
|
ui::completers::none,
|
|
|
|
ui::completers::none,
|
|
|
|
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
|
|
|
|
move |cx, input: &str, event: PromptEvent| {
|
|
|
|
let config = cx.editor.config();
|
|
|
|
let config = cx.editor.config();
|
|
|
|
let shell = &config.shell;
|
|
|
|
let shell = &config.shell;
|
|
|
|
if event != PromptEvent::Validate {
|
|
|
|
if event != PromptEvent::Validate {
|
|
|
@ -4273,8 +4272,6 @@ fn shell(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBehavior) {
|
|
|
|
view.ensure_cursor_in_view(doc, config.scrolloff);
|
|
|
|
view.ensure_cursor_in_view(doc, config.scrolloff);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
cx.push_layer(Box::new(prompt));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn suspend(_cx: &mut Context) {
|
|
|
|
fn suspend(_cx: &mut Context) {
|
|
|
@ -4420,13 +4417,11 @@ fn replay_macro(cx: &mut Context) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let count = cx.count();
|
|
|
|
let count = cx.count();
|
|
|
|
cx.callback = Some(Box::new(
|
|
|
|
cx.callback = Some(Box::new(move |compositor, cx| {
|
|
|
|
move |compositor: &mut Compositor, cx: &mut compositor::Context| {
|
|
|
|
for _ in 0..count {
|
|
|
|
for _ in 0..count {
|
|
|
|
for &key in keys.iter() {
|
|
|
|
for &key in keys.iter() {
|
|
|
|
compositor.handle_event(crossterm::event::Event::Key(key.into()), cx);
|
|
|
|
compositor.handle_event(crossterm::event::Event::Key(key.into()), cx);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|