aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/comp.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-17 02:29:30 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-17 02:39:56 +0800
commit6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (patch)
treebc7049698955d7a40706ea691fd5bab526a6b5e5 /mingling_core/src/comp.rs
parent4c191b2b46a67a0dda6e9a867b40f45156af4f9c (diff)
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).
Diffstat (limited to 'mingling_core/src/comp.rs')
-rw-r--r--mingling_core/src/comp.rs40
1 files changed, 0 insertions, 40 deletions
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::<P>();
-
- #[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<String> = node.split(' ').map(str::to_string).collect();
- #[cfg(feature = "dispatch_tree")]
let lazy_member = P::dispatch_args(&words).ok().map(|any| any.member_id);
- #[cfg(not(feature = "dispatch_tree"))]
- let lazy_member = match match_user_input(this::<P>(), &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::<Description>(member_id).map(String::from)
}