From 78cfcd607f886fc0af506ec4f005ea1954f42850 Mon Sep 17 00:00:00 2001 From: multiplex55 <6619098+multiplex55@users.noreply.github.com> Date: Thu, 5 Feb 2026 19:35:32 -0500 Subject: [PATCH] Update todo add labels with tags and priority --- src/plugins/todo.rs | 14 +++++++++++++- tests/todo_plugin.rs | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/todo.rs b/src/plugins/todo.rs index 1fef5978..439f6c5c 100644 --- a/src/plugins/todo.rs +++ b/src/plugins/todo.rs @@ -409,8 +409,20 @@ impl TodoPlugin { }) { ParseArgsResult::Parsed((text, priority, tags)) => { let tag_str = tags.join(","); + let mut label_suffix_parts: Vec = Vec::new(); + if !tags.is_empty() { + label_suffix_parts.push(format!("Tag: {}", tags.join(", "))); + } + if priority > 0 { + label_suffix_parts.push(format!("priority: {priority}")); + } + let label = if label_suffix_parts.is_empty() { + format!("Add todo {text}") + } else { + format!("Add todo {text} {}", label_suffix_parts.join("; ")) + }; return vec![Action { - label: format!("Add todo {text}"), + label, desc: "Todo".into(), action: format!("todo:add:{text}|{priority}|{tag_str}"), args: None, diff --git a/tests/todo_plugin.rs b/tests/todo_plugin.rs index 8f5041da..0cfa9ec0 100644 --- a/tests/todo_plugin.rs +++ b/tests/todo_plugin.rs @@ -39,6 +39,7 @@ fn search_add_returns_action() { let results = plugin.search("todo add task "); assert_eq!(results.len(), 1); assert_eq!(results[0].action, "todo:add:task|0|"); + assert_eq!(results[0].label, "Add todo task"); } #[test] @@ -48,6 +49,7 @@ fn search_add_with_priority_and_tags() { let results = plugin.search("todo add task p=3 #a #b"); assert_eq!(results.len(), 1); assert_eq!(results[0].action, "todo:add:task|3|a,b"); + assert_eq!(results[0].label, "Add todo task Tag: a, b; priority: 3"); } #[test] @@ -57,6 +59,7 @@ fn search_add_with_at_tags() { let results = plugin.search("todo add task @a @b"); assert_eq!(results.len(), 1); assert_eq!(results[0].action, "todo:add:task|0|a,b"); + assert_eq!(results[0].label, "Add todo task Tag: a, b"); } #[test]