@@ -3681,149 +3681,6 @@ pub(super) fn command_mode(cx: &mut Context) {
3681
3681
let mut prompt = Prompt :: new (
3682
3682
":" . into ( ) ,
3683
3683
Some ( ':' ) ,
3684
- // <<<<<<< HEAD
3685
- // |editor: &Editor, input: &str| {
3686
- // let shellwords = Shellwords::from(input);
3687
- // let words = shellwords.words();
3688
-
3689
- // if words.is_empty() || (words.len() == 1 && !shellwords.ends_with_whitespace()) {
3690
- // fuzzy_match(
3691
- // input,
3692
- // TYPABLE_COMMAND_LIST
3693
- // .iter()
3694
- // .map(|command| Cow::from(command.name))
3695
- // .chain(crate::commands::engine::ScriptingEngine::available_commands()),
3696
- // false,
3697
- // )
3698
- // .into_iter()
3699
- // .map(|(name, _)| (0.., name.into()))
3700
- // .collect()
3701
- // } else {
3702
- // // Otherwise, use the command's completer and the last shellword
3703
- // // as completion input.
3704
- // let (word, word_len) = if words.len() == 1 || shellwords.ends_with_whitespace() {
3705
- // (&Cow::Borrowed(""), 0)
3706
- // } else {
3707
- // (words.last().unwrap(), words.last().unwrap().len())
3708
- // };
3709
-
3710
- // let argument_number = argument_number_of(&shellwords);
3711
-
3712
- // if let Some(completer) = TYPABLE_COMMAND_MAP
3713
- // .get(&words[0] as &str)
3714
- // .map(|tc| tc.completer_for_argument_number(argument_number))
3715
- // {
3716
- // completer(editor, word)
3717
- // .into_iter()
3718
- // .map(|(range, mut file)| {
3719
- // file.content = shellwords::escape(file.content);
3720
-
3721
- // // offset ranges to input
3722
- // let offset = input.len() - word_len;
3723
- // let range = (range.start + offset)..;
3724
- // (range, file)
3725
- // })
3726
- // .collect()
3727
- // } else {
3728
- // Vec::new()
3729
- // }
3730
- // }
3731
- // }, // completion
3732
- // move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
3733
- // let parts = input.split_whitespace().collect::<Vec<&str>>();
3734
- // if parts.is_empty() {
3735
- // return;
3736
- // }
3737
-
3738
- // // If command is numeric, interpret as line number and go there.
3739
- // if parts.len() == 1 && parts[0].parse::<usize>().ok().is_some() {
3740
- // if let Err(e) = typed::goto_line_number(cx, &[Cow::from(parts[0])], event) {
3741
- // cx.editor.set_error(format!("{}", e));
3742
- // }
3743
- // return;
3744
- // }
3745
-
3746
- // // TODO: @Matt - Add completion for added scripting commands here
3747
- // // Handle typable commands
3748
-
3749
- // // Register callback functions here - if the prompt event is validate,
3750
- // // Grab the function run and run through the hooks.
3751
- // if let Some(cmd) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) {
3752
- // let shellwords = Shellwords::from(input);
3753
- // let args = shellwords.words();
3754
- // if let Err(e) = (cmd.fun)(cx, &args[1..], event) {
3755
- // cx.editor.set_error(format!("{}", e));
3756
- // }
3757
-
3758
- // if event == PromptEvent::Validate {
3759
- // let mappable_command = MappableCommand::Typable {
3760
- // name: cmd.name.to_string(),
3761
- // args: Vec::new(),
3762
- // doc: "".to_string(),
3763
- // };
3764
-
3765
- // let mut ctx = Context {
3766
- // register: None,
3767
- // count: None,
3768
- // editor: cx.editor,
3769
- // callback: Vec::new(),
3770
- // on_next_key_callback: None,
3771
- // jobs: cx.jobs,
3772
- // };
3773
-
3774
- // // // TODO: Figure this out?
3775
- // helix_event::dispatch(crate::events::PostCommand {
3776
- // command: &mappable_command,
3777
- // cx: &mut ctx,
3778
- // });
3779
- // }
3780
- // } else if ScriptingEngine::call_typed_command(cx, input, &parts, event) {
3781
- // // Engine handles the other cases
3782
- // if event == PromptEvent::Validate {
3783
- // let mappable_command = MappableCommand::Typable {
3784
- // name: input.to_string(),
3785
- // args: Vec::new(),
3786
- // doc: "".to_string(),
3787
- // };
3788
-
3789
- // let mut ctx = Context {
3790
- // register: None,
3791
- // count: None,
3792
- // editor: cx.editor,
3793
- // callback: Vec::new(),
3794
- // on_next_key_callback: None,
3795
- // jobs: cx.jobs,
3796
- // };
3797
-
3798
- // // // TODO: Figure this out?
3799
- // helix_event::dispatch(crate::events::PostCommand {
3800
- // command: &mappable_command,
3801
- // cx: &mut ctx,
3802
- // });
3803
- // }
3804
- // } else if event == PromptEvent::Validate {
3805
- // cx.editor
3806
- // .set_error(format!("no such command: '{}'", parts[0]));
3807
- // }
3808
- // },
3809
- // );
3810
- // prompt.doc_fn = Box::new(|input: &str| {
3811
- // let part = input.split(' ').next().unwrap_or_default();
3812
-
3813
- // if let Some(typed::TypableCommand { doc, aliases, .. }) =
3814
- // typed::TYPABLE_COMMAND_MAP.get(part)
3815
- // {
3816
- // if aliases.is_empty() {
3817
- // return Some((*doc).into());
3818
- // }
3819
- // return Some(format!("{}\nAliases: {}", doc, aliases.join(", ")).into());
3820
- // } else if let Some(doc) = ScriptingEngine::get_doc_for_identifier(part) {
3821
- // return Some(doc.into());
3822
- // }
3823
-
3824
- // None
3825
- // });
3826
- // =======
3827
3684
complete_command_line,
3828
3685
move |cx : & mut compositor:: Context , input : & str , event : PromptEvent | {
3829
3686
if let Err ( err) = execute_command_line ( cx, input, event) {
@@ -3832,7 +3689,6 @@ pub(super) fn command_mode(cx: &mut Context) {
3832
3689
} ,
3833
3690
) ;
3834
3691
prompt. doc_fn = Box :: new ( command_line_doc) ;
3835
- // >>>>>>> origin
3836
3692
3837
3693
// Calculate initial completion
3838
3694
prompt. recalculate_completion ( cx. editor ) ;
0 commit comments