mirror of https://github.com/helix-editor/helix
cleanup
parent
cfb7a58960
commit
f407a043b0
|
@ -3681,149 +3681,6 @@ pub(super) fn command_mode(cx: &mut Context) {
|
|||
let mut prompt = Prompt::new(
|
||||
":".into(),
|
||||
Some(':'),
|
||||
// <<<<<<< HEAD
|
||||
// |editor: &Editor, input: &str| {
|
||||
// let shellwords = Shellwords::from(input);
|
||||
// let words = shellwords.words();
|
||||
|
||||
// if words.is_empty() || (words.len() == 1 && !shellwords.ends_with_whitespace()) {
|
||||
// fuzzy_match(
|
||||
// input,
|
||||
// TYPABLE_COMMAND_LIST
|
||||
// .iter()
|
||||
// .map(|command| Cow::from(command.name))
|
||||
// .chain(crate::commands::engine::ScriptingEngine::available_commands()),
|
||||
// false,
|
||||
// )
|
||||
// .into_iter()
|
||||
// .map(|(name, _)| (0.., name.into()))
|
||||
// .collect()
|
||||
// } else {
|
||||
// // Otherwise, use the command's completer and the last shellword
|
||||
// // as completion input.
|
||||
// let (word, word_len) = if words.len() == 1 || shellwords.ends_with_whitespace() {
|
||||
// (&Cow::Borrowed(""), 0)
|
||||
// } else {
|
||||
// (words.last().unwrap(), words.last().unwrap().len())
|
||||
// };
|
||||
|
||||
// let argument_number = argument_number_of(&shellwords);
|
||||
|
||||
// if let Some(completer) = TYPABLE_COMMAND_MAP
|
||||
// .get(&words[0] as &str)
|
||||
// .map(|tc| tc.completer_for_argument_number(argument_number))
|
||||
// {
|
||||
// completer(editor, word)
|
||||
// .into_iter()
|
||||
// .map(|(range, mut file)| {
|
||||
// file.content = shellwords::escape(file.content);
|
||||
|
||||
// // offset ranges to input
|
||||
// let offset = input.len() - word_len;
|
||||
// let range = (range.start + offset)..;
|
||||
// (range, file)
|
||||
// })
|
||||
// .collect()
|
||||
// } else {
|
||||
// Vec::new()
|
||||
// }
|
||||
// }
|
||||
// }, // completion
|
||||
// move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
|
||||
// let parts = input.split_whitespace().collect::<Vec<&str>>();
|
||||
// if parts.is_empty() {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // If command is numeric, interpret as line number and go there.
|
||||
// if parts.len() == 1 && parts[0].parse::<usize>().ok().is_some() {
|
||||
// if let Err(e) = typed::goto_line_number(cx, &[Cow::from(parts[0])], event) {
|
||||
// cx.editor.set_error(format!("{}", e));
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // TODO: @Matt - Add completion for added scripting commands here
|
||||
// // Handle typable commands
|
||||
|
||||
// // Register callback functions here - if the prompt event is validate,
|
||||
// // Grab the function run and run through the hooks.
|
||||
// if let Some(cmd) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) {
|
||||
// let shellwords = Shellwords::from(input);
|
||||
// let args = shellwords.words();
|
||||
// if let Err(e) = (cmd.fun)(cx, &args[1..], event) {
|
||||
// cx.editor.set_error(format!("{}", e));
|
||||
// }
|
||||
|
||||
// if event == PromptEvent::Validate {
|
||||
// let mappable_command = MappableCommand::Typable {
|
||||
// name: cmd.name.to_string(),
|
||||
// args: Vec::new(),
|
||||
// doc: "".to_string(),
|
||||
// };
|
||||
|
||||
// let mut ctx = Context {
|
||||
// register: None,
|
||||
// count: None,
|
||||
// editor: cx.editor,
|
||||
// callback: Vec::new(),
|
||||
// on_next_key_callback: None,
|
||||
// jobs: cx.jobs,
|
||||
// };
|
||||
|
||||
// // // TODO: Figure this out?
|
||||
// helix_event::dispatch(crate::events::PostCommand {
|
||||
// command: &mappable_command,
|
||||
// cx: &mut ctx,
|
||||
// });
|
||||
// }
|
||||
// } else if ScriptingEngine::call_typed_command(cx, input, &parts, event) {
|
||||
// // Engine handles the other cases
|
||||
// if event == PromptEvent::Validate {
|
||||
// let mappable_command = MappableCommand::Typable {
|
||||
// name: input.to_string(),
|
||||
// args: Vec::new(),
|
||||
// doc: "".to_string(),
|
||||
// };
|
||||
|
||||
// let mut ctx = Context {
|
||||
// register: None,
|
||||
// count: None,
|
||||
// editor: cx.editor,
|
||||
// callback: Vec::new(),
|
||||
// on_next_key_callback: None,
|
||||
// jobs: cx.jobs,
|
||||
// };
|
||||
|
||||
// // // TODO: Figure this out?
|
||||
// helix_event::dispatch(crate::events::PostCommand {
|
||||
// command: &mappable_command,
|
||||
// cx: &mut ctx,
|
||||
// });
|
||||
// }
|
||||
// } else if event == PromptEvent::Validate {
|
||||
// cx.editor
|
||||
// .set_error(format!("no such command: '{}'", parts[0]));
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// prompt.doc_fn = Box::new(|input: &str| {
|
||||
// let part = input.split(' ').next().unwrap_or_default();
|
||||
|
||||
// if let Some(typed::TypableCommand { doc, aliases, .. }) =
|
||||
// typed::TYPABLE_COMMAND_MAP.get(part)
|
||||
// {
|
||||
// if aliases.is_empty() {
|
||||
// return Some((*doc).into());
|
||||
// }
|
||||
// return Some(format!("{}\nAliases: {}", doc, aliases.join(", ")).into());
|
||||
// } else if let Some(doc) = ScriptingEngine::get_doc_for_identifier(part) {
|
||||
// return Some(doc.into());
|
||||
// }
|
||||
|
||||
// None
|
||||
// });
|
||||
// =======
|
||||
complete_command_line,
|
||||
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
|
||||
if let Err(err) = execute_command_line(cx, input, event) {
|
||||
|
@ -3832,7 +3689,6 @@ pub(super) fn command_mode(cx: &mut Context) {
|
|||
},
|
||||
);
|
||||
prompt.doc_fn = Box::new(command_line_doc);
|
||||
// >>>>>>> origin
|
||||
|
||||
// Calculate initial completion
|
||||
prompt.recalculate_completion(cx.editor);
|
||||
|
|
|
@ -166,12 +166,9 @@ Usage: Run with `cargo xtask <task>`, eg. `cargo xtask docgen`.
|
|||
Tasks:
|
||||
docgen: Generate files to be included in the mdbook output.
|
||||
query-check: Check that tree-sitter queries are valid.
|
||||
<<<<<<< HEAD
|
||||
code-gen: Generate files associated with steel
|
||||
steel: Install steel
|
||||
=======
|
||||
theme-check: Check that theme files in runtime/themes are valid.
|
||||
>>>>>>> origin
|
||||
"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue