From 6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 17 Aug 2026 02:29:30 +0800 Subject: refactor!: remove dynamic dispatcher registration API Dispatchers are now always registered at compile time, removing the `with_dispatcher` / `with_dispatchers` methods and the `PathfinderConfig` API. The `dispatch_tree` feature now only controls the matching strategy (trie vs linear list). --- mingling_core/src/comp.rs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'mingling_core/src/comp.rs') diff --git a/mingling_core/src/comp.rs b/mingling_core/src/comp.rs index aea46e1..399c9bf 100644 --- a/mingling_core/src/comp.rs +++ b/mingling_core/src/comp.rs @@ -37,12 +37,6 @@ pub const COMPLETION_SUBCOMMAND: &str = "__comp"; #[cfg(feature = "debug")] use crate::debug::init_env_logger; -#[cfg(not(feature = "dispatch_tree"))] -use crate::ChainProcess; - -#[cfg(not(feature = "dispatch_tree"))] -use crate::exec::match_user_input; - /// Mingling Completion Entry Point /// /// Defines the custom completion logic entry point for the program's shell @@ -174,30 +168,6 @@ impl CompletionHelper { let args = first_cmd_match.map_or_else(Vec::new, |start| all_args[start..].to_vec()); trace!("arguments=\"{}\"", args.join(", ")); - #[cfg(not(feature = "dispatch_tree"))] - let program = this::
();
-
- #[cfg(not(feature = "dispatch_tree"))]
- let suggest = if let Ok((dispatcher, args)) = match_user_input(program, &args) {
- trace!(
- "dispatcher matched, dispatcher=\"{}\"",
- dispatcher.node().to_string(),
- );
- let begin = dispatcher.begin(args);
- if let crate::ChainProcess::Ok((any, _)) = begin {
- trace!("entry type: {}", any.member_id);
- let result = P::do_comp(&any, ctx);
- trace!("do_comp result: {:?}", result);
- Some(result)
- } else {
- trace!("begin not Ok");
- None
- }
- } else {
- trace!("no dispatcher matched");
- None
- };
- #[cfg(feature = "dispatch_tree")]
let suggest = if let Ok(any) = P::dispatch_args(&args) {
debug!("dispatch_args OK, member_id = {:?}", any.member_id);
trace!("entry type: {}", any.member_id);
@@ -354,18 +324,8 @@ where
{
let words: Vec (), &words) {
- Ok((dispatcher, args)) => match dispatcher.begin(args) {
- ChainProcess::Ok((any, _)) => Some(any.member_id),
- ChainProcess::Err(_) => None,
- },
- Err(_) => None,
- };
-
let member_id = lazy_member?;
P::get_metadata::