File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ impl PluginManager {
326326 }
327327 if let Some ( map) = enabled_caps {
328328 if let Some ( caps) = map. get ( name) {
329- if !caps. contains ( & "search" . to_string ( ) ) {
329+ if !caps. iter ( ) . any ( |c| c == "search" ) {
330330 continue ;
331331 }
332332 }
Original file line number Diff line number Diff line change @@ -128,6 +128,28 @@ fn global_plugins_and_opt_out_plugins_still_run() {
128128 assert_eq ! ( prefixed_calls. load( Ordering :: SeqCst ) , 0 ) ;
129129}
130130
131+ #[ test]
132+ fn search_capability_gate_skips_plugin_when_disabled ( ) {
133+ use std:: collections:: HashMap ;
134+
135+ let calls = Arc :: new ( AtomicUsize :: new ( 0 ) ) ;
136+
137+ let mut pm = PluginManager :: new ( ) ;
138+ pm. register ( Box :: new ( CountingPlugin :: new (
139+ "searchable" ,
140+ & [ ] ,
141+ false ,
142+ calls. clone ( ) ,
143+ ) ) ) ;
144+
145+ let mut enabled_caps = HashMap :: new ( ) ;
146+ enabled_caps. insert ( "searchable" . to_string ( ) , vec ! [ "commands" . to_string( ) ] ) ;
147+
148+ let out = pm. search_filtered ( "query" , None , Some ( & enabled_caps) ) ;
149+ assert ! ( out. is_empty( ) ) ;
150+ assert_eq ! ( calls. load( Ordering :: SeqCst ) , 0 ) ;
151+ }
152+
131153#[ test]
132154fn existing_prefix_commands_remain_equivalent ( ) {
133155 let plugin = TodoPlugin :: default ( ) ;
You can’t perform that action at this time.
0 commit comments