-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathmod.rs
More file actions
635 lines (571 loc) · 25.1 KB
/
mod.rs
File metadata and controls
635 lines (571 loc) · 25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
mod saved_prompts;
mod zero_state;
use ai::skills::SkillProvider;
pub(crate) use saved_prompts::*;
use warp_core::features::FeatureFlag;
pub use zero_state::*;
use std::collections::HashMap;
use std::path::PathBuf;
use fuzzy_match::FuzzyMatchResult;
use ordered_float::OrderedFloat;
use warp_core::ui::appearance::Appearance;
use warpui::fonts::FamilyId;
use warpui::{AppContext, Entity, EntityId, ModelContext, ModelHandle, SingletonEntity};
use crate::ai::agent_conversations_model::{AgentConversationsModel, AgentConversationsModelEvent};
use crate::ai::blocklist::BlocklistAIHistoryModel;
use crate::ai::skills::{SkillDescriptor, SkillManager};
use crate::search::data_source::{Query, QueryResult};
use crate::search::mixer::DataSourceRunErrorWrapper;
use crate::search::slash_command_menu::fuzzy_match::SlashCommandFuzzyMatchResult;
use crate::search::slash_command_menu::static_commands::Availability;
use crate::terminal::cli_agent_sessions::{
CLIAgentInputState, CLIAgentSessionsModel, CLIAgentSessionsModelEvent,
};
use crate::terminal::model::session::SessionType;
#[cfg(not(target_family = "wasm"))]
use warp_cli::agent::Harness;
use warp_core::ui::Icon as WarpIcon;
use super::AcceptSlashCommandOrSavedPrompt;
use crate::{
ai::blocklist::{
agent_view::{AgentViewController, AgentViewControllerEvent},
block::cli_controller::{CLISubagentController, CLISubagentEvent},
BlocklistAIHistoryEvent,
},
search::{
slash_command_menu::{
static_commands::commands::{self, COMMAND_REGISTRY},
SlashCommandId, StaticCommand,
},
SyncDataSource,
},
settings::{AISettings, AISettingsChangedEvent, InputSettings, InputSettingsChangedEvent},
terminal::model::session::active_session::{ActiveSession, ActiveSessionEvent},
workspaces::user_workspaces::{UserWorkspaces, UserWorkspacesEvent},
};
pub struct DataSourceArgs {
pub active_session: ModelHandle<ActiveSession>,
pub agent_view_controller: ModelHandle<AgentViewController>,
pub cli_subagent_controller: ModelHandle<CLISubagentController>,
pub terminal_view_id: EntityId,
}
pub struct SlashCommandDataSource {
active_session: ModelHandle<ActiveSession>,
agent_view_controller: ModelHandle<AgentViewController>,
cli_subagent_controller: ModelHandle<CLISubagentController>,
terminal_view_id: EntityId,
active_commands_by_id: HashMap<SlashCommandId, StaticCommand>,
active_repo_root: Option<PathBuf>,
is_cloud_mode_v2: bool,
}
impl SlashCommandDataSource {
pub fn new(args: DataSourceArgs, ctx: &mut ModelContext<Self>) -> Self {
Self::build(args, false, ctx)
}
pub fn for_cloud_mode_v2(args: DataSourceArgs, ctx: &mut ModelContext<Self>) -> Self {
Self::build(args, true, ctx)
}
fn build(args: DataSourceArgs, is_cloud_mode_v2: bool, ctx: &mut ModelContext<Self>) -> Self {
let DataSourceArgs {
active_session,
agent_view_controller,
cli_subagent_controller,
terminal_view_id,
} = args;
ctx.subscribe_to_model(&active_session, |me, event, ctx| match event {
ActiveSessionEvent::UpdatedPwd | ActiveSessionEvent::Bootstrapped => {
me.recompute_active_commands(ctx);
}
});
ctx.subscribe_to_model(&cli_subagent_controller, |me, event, ctx| {
if let CLISubagentEvent::SpawnedSubagent { .. }
| CLISubagentEvent::FinishedSubagent { .. }
| CLISubagentEvent::UpdatedControl { .. } = event
{
me.recompute_active_commands(ctx);
}
});
ctx.subscribe_to_model(&agent_view_controller, |me, event, ctx| match event {
AgentViewControllerEvent::EnteredAgentView { .. }
| AgentViewControllerEvent::ExitedAgentView { .. } => {
me.recompute_active_commands(ctx);
}
_ => (),
});
ctx.subscribe_to_model(&AISettings::handle(ctx), |me, event, ctx| {
if matches!(
event,
AISettingsChangedEvent::IsAnyAIEnabled { .. }
| AISettingsChangedEvent::OrchestrationEnabled { .. }
) {
me.recompute_active_commands(ctx);
}
});
ctx.subscribe_to_model(&InputSettings::handle(ctx), |me, event, ctx| {
if matches!(
event,
InputSettingsChangedEvent::EnableSlashCommandsInTerminal { .. }
) {
me.recompute_active_commands(ctx);
}
});
ctx.subscribe_to_model(&UserWorkspaces::handle(ctx), |me, event, ctx| {
if matches!(event, UserWorkspacesEvent::CodebaseContextEnablementChanged) {
me.recompute_active_commands(ctx);
}
});
ctx.subscribe_to_model(
&CLIAgentSessionsModel::handle(ctx),
move |me, event, ctx| {
if let CLIAgentSessionsModelEvent::InputSessionChanged {
terminal_view_id: event_terminal_view_id,
..
} = event
{
if *event_terminal_view_id == terminal_view_id {
me.recompute_active_commands(ctx);
}
}
},
);
// Recompute when the active conversation switches so commands gated on the active
// conversation's task (e.g. /continue-locally) update on navigation.
ctx.subscribe_to_model(&BlocklistAIHistoryModel::handle(ctx), |me, event, ctx| {
if matches!(
event,
BlocklistAIHistoryEvent::SetActiveConversation { .. }
| BlocklistAIHistoryEvent::ClearedActiveConversation { .. }
) {
me.recompute_active_commands(ctx);
}
});
// Recompute when task data is updated so commands gated on a conversation's task
// harness (e.g. /continue-locally) appear once the task fetch resolves.
ctx.subscribe_to_model(&AgentConversationsModel::handle(ctx), |me, event, ctx| {
if matches!(
event,
AgentConversationsModelEvent::TasksUpdated
| AgentConversationsModelEvent::NewTasksReceived
) {
me.recompute_active_commands(ctx);
}
});
let mut me = Self {
active_session,
agent_view_controller,
cli_subagent_controller,
terminal_view_id,
active_commands_by_id: Default::default(),
active_repo_root: None,
is_cloud_mode_v2,
};
me.recompute_active_commands(ctx);
me
}
/// Slash commands that are available in CLI agent rich input mode.
/// Add command names here to make them accessible when composing prompts
/// for a running CLI agent (Claude Code, Codex, etc.).
const CLI_AGENT_INPUT_ALLOWED_COMMANDS: &[&str] = &["/prompts", "/skills"];
fn recompute_active_commands(&mut self, ctx: &mut ModelContext<Self>) {
let is_cli_agent_input = self.is_cli_agent_input_open(ctx);
let mut session_context = Availability::empty();
let is_agent_view_active = self.agent_view_controller.as_ref(ctx).is_active();
if !FeatureFlag::AgentView.is_enabled() {
// When the AgentView feature flag is disabled, set both view bits so that
// either view requirement is satisfied (but other requirements like
// REPOSITORY and LOCAL still apply).
session_context |= Availability::AGENT_VIEW | Availability::TERMINAL_VIEW;
} else if is_agent_view_active {
session_context |= Availability::AGENT_VIEW;
} else {
session_context |= Availability::TERMINAL_VIEW;
}
if self.active_repo_root.is_some() {
session_context |= Availability::REPOSITORY;
}
let is_local = self
.active_session
.as_ref(ctx)
.session_type(ctx)
.is_some_and(|st| st == SessionType::Local);
if is_local {
session_context |= Availability::LOCAL;
}
if !self
.cli_subagent_controller
.as_ref(ctx)
.is_agent_in_control()
{
session_context |= Availability::NO_LRC_CONTROL;
}
let has_active_conversation = if is_agent_view_active {
// There is always an active conversation in the agent view.
true
} else {
BlocklistAIHistoryModel::as_ref(ctx)
.active_conversation(self.terminal_view_id)
.is_some()
};
if has_active_conversation {
session_context |= Availability::ACTIVE_CONVERSATION;
}
if UserWorkspaces::as_ref(ctx).is_codebase_context_enabled(ctx) {
session_context |= Availability::CODEBASE_CONTEXT;
}
if AISettings::as_ref(ctx).is_any_ai_enabled(ctx) {
session_context |= Availability::AI_ENABLED;
}
<<<<<<< HEAD
if self.is_cloud_mode_v2 && FeatureFlag::CloudModeInputV2.is_enabled() {
session_context |= Availability::CLOUD_AGENT_V2;
}
=======
>>>>>>> b5e670ed (curr)
if !self.is_cloud_mode_v2 {
session_context |= Availability::NOT_CLOUD_AGENT;
}
let is_orchestration_enabled = AISettings::as_ref(ctx).is_orchestration_enabled(ctx);
#[cfg(not(target_family = "wasm"))]
let active_conversation_is_cloud_oz = self.active_conversation_is_cloud_oz(ctx);
let old_active_command_count = self.active_commands_by_id.len();
self.active_commands_by_id = HashMap::from_iter(
COMMAND_REGISTRY
.all_commands_by_id()
.filter(|(_, command)| command.is_active(session_context))
.filter(|(_, command)| {
command.name != commands::ORCHESTRATE_NAME || is_orchestration_enabled
})
// The static `/feedback` command is an AI-off fallback for the richer bundled
// `feedback` skill. Hide it whenever the bundled skill will actually take over,
// matching the precedence used by `Workspace::send_feedback`.
.filter(|(_, command)| {
command.name != commands::FEEDBACK.name
|| !crate::workspace::is_feedback_skill_available(ctx)
})
// /continue-locally only applies to cloud Oz conversations. Local conversations
// and non-Oz cloud runs (Claude, Gemini) are filtered out so the slash menu
// doesn't surface a no-op command.
.filter(|(_, command)| {
#[cfg(not(target_family = "wasm"))]
{
command.name != commands::CONTINUE_LOCALLY.name
|| active_conversation_is_cloud_oz
}
#[cfg(target_family = "wasm")]
{
let _ = command;
true
}
})
// When CLI agent input is open, restrict to the explicit allowlist.
.filter(|(_, command)| {
!is_cli_agent_input
|| Self::CLI_AGENT_INPUT_ALLOWED_COMMANDS.contains(&command.name)
})
.map(|(id, command)| (id, command.clone())),
);
// This is an imperfect heuristic, but better than re-firing unnecessarily.
//
// If it actually matters, we can update it.
if self.active_commands_by_id.len() != old_active_command_count {
ctx.emit(UpdatedActiveCommands);
}
}
/// Update the active repository root for this terminal. Called by the parent when
/// the terminal navigates into or out of a git repository.
pub fn set_active_repo_root(
&mut self,
repo_root: Option<PathBuf>,
ctx: &mut ModelContext<Self>,
) {
if self.active_repo_root != repo_root {
self.active_repo_root = repo_root;
self.recompute_active_commands(ctx);
}
}
pub fn active_commands(&self) -> impl Iterator<Item = (&SlashCommandId, &StaticCommand)> {
self.active_commands_by_id.iter()
}
pub fn is_agent_view_active(&self, ctx: &AppContext) -> bool {
self.agent_view_controller.as_ref(ctx).is_active()
}
pub fn active_session_for_v2_zero_state(&self) -> &ModelHandle<ActiveSession> {
&self.active_session
}
/// Returns `true` if the CLI agent rich input is currently open for this terminal.
pub fn is_cli_agent_input_open(&self, ctx: &AppContext) -> bool {
CLIAgentSessionsModel::as_ref(ctx).is_input_open(self.terminal_view_id)
}
/// Returns the supported skill providers for the active CLI agent, or `None` if
/// CLI agent input is not open (meaning no filtering should be applied).
pub fn active_cli_agent_providers(
&self,
ctx: &AppContext,
) -> Option<&'static [ai::skills::SkillProvider]> {
CLIAgentSessionsModel::as_ref(ctx)
.session(self.terminal_view_id)
.filter(|s| matches!(s.input_state, CLIAgentInputState::Open { .. }))
.map(|s| s.agent.supported_skill_providers())
}
/// Returns true when the active conversation is associated with a cloud Oz
/// `AmbientAgentTask`. Used to gate `/continue-locally` to runs that can
/// actually be forked into a local Warp conversation.
///
/// Permissive when the harness is not yet known: we consider an absent task or
/// missing `agent_config_snapshot.harness` to be Oz, matching the existing
/// tombstone gate (`conversation_ended_tombstone_view::render_action_buttons`).
/// Only an explicit non-Oz harness (Claude, Gemini, OpenCode, Unknown) hides the
/// command. Conversations without a `task_id` are local and never qualify.
#[cfg(not(target_family = "wasm"))]
fn active_conversation_is_cloud_oz(&self, ctx: &AppContext) -> bool {
let agent_view_state = self.agent_view_controller.as_ref(ctx).agent_view_state();
let conversation_id = match agent_view_state.active_conversation_id() {
Some(id) => id,
None => match BlocklistAIHistoryModel::as_ref(ctx)
.active_conversation(self.terminal_view_id)
{
Some(conv) => conv.id(),
None => return false,
},
};
let history = BlocklistAIHistoryModel::as_ref(ctx);
let Some(conversation) = history.conversation(&conversation_id) else {
return false;
};
let Some(task_id) = conversation.task_id() else {
return false;
};
let Some(task) = AgentConversationsModel::as_ref(ctx).get_task_data(&task_id) else {
// Task data not yet fetched. Permissive default: assume Oz so the command
// is reachable while the fetch is in flight; once the fetch resolves,
// `TasksUpdated` triggers a recompute and a non-Oz task hides the command.
return true;
};
match task
.agent_config_snapshot
.as_ref()
.and_then(|s| s.harness.as_ref())
{
Some(config) => config.harness_type == Harness::Oz,
None => true,
}
}
}
impl SyncDataSource for SlashCommandDataSource {
type Action = AcceptSlashCommandOrSavedPrompt;
fn run_query(
&self,
query: &Query,
app: &warpui::AppContext,
) -> Result<Vec<QueryResult<Self::Action>>, DataSourceRunErrorWrapper> {
if query.text.is_empty() {
return Ok(vec![]);
}
let query_text = query.text.trim().to_lowercase();
let mut results = Vec::new();
/// Multiplier to ensure static commands always appear at the top of the match results.
const SCORE_MULTIPLIER: OrderedFloat<f64> = OrderedFloat(1000.0);
for (id, command) in self.active_commands_by_id.iter() {
if let Some(fuzzy_result) = SlashCommandFuzzyMatchResult::try_match(
&query_text,
command.name,
None, // Don't match on description for slash commands.
) {
let score = fuzzy_result.score();
// Only include results with score > 25 once the user has started typing a query and is past the first character
if query_text.len() > 1 && score <= 25.0 {
continue;
}
// Boost prefix matches so that closer matches (e.g. "new" → "/new")
// rank above longer fuzzy matches (e.g. "new" → "/create-new-project").
let prefix_boost = prefix_match_bonus(&query_text, command.name);
results.push(QueryResult::from(
InlineItem::from_slash_command(id, command, app)
.with_name_match_result(fuzzy_result.name_match_result)
.with_description_match_result(fuzzy_result.description_match_result)
.with_compact_layout(self.is_cloud_mode_v2)
.with_score(
OrderedFloat(score) * SCORE_MULTIPLIER
+ OrderedFloat(prefix_boost) * SCORE_MULTIPLIER
// Boost commands with shorter names, if match result is otherwise
// equal.
+ OrderedFloat(1. / command.name.len() as f64),
),
));
}
}
// Also search skills — when CLI agent input is open, filter to natively supported providers.
// Skills are invoked by the agent, so they're hidden entirely when AI is globally off.
if FeatureFlag::ListSkills.is_enabled() && AISettings::as_ref(app).is_any_ai_enabled(app) {
let cli_agent_providers = self.active_cli_agent_providers(app);
let cwd = self.active_session.as_ref(app).current_working_directory();
let cwd_path = cwd.as_ref().map(std::path::Path::new);
let skills = SkillManager::handle(app)
.as_ref(app)
.get_skills_for_working_directory(cwd_path, app);
let skill_manager = SkillManager::as_ref(app);
for mut skill in skills {
// In CLI agent input mode, only show skills that exist in a supported
// provider folder. We check all paths (not just the deduplicated
// provider) because deduplication may have picked a higher-priority
// provider even when the skill also exists in the CLI agent's folder.
if let Some(providers) = &cli_agent_providers {
if !skill_manager.skill_exists_for_any_provider(&skill, providers) {
continue;
}
// Re-map the provider to the best supported one so the icon
// reflects the active CLI agent's native provider.
skill.provider = skill_manager.best_supported_provider(&skill, providers);
}
if let Some(fuzzy_result) = SlashCommandFuzzyMatchResult::try_match(
&query_text,
&skill.name,
Some(&skill.description),
) {
let score = fuzzy_result.score();
// Only include results with score > 25 once the user has started typing a query
if query_text.len() > 1 && score <= 25.0 {
continue;
}
let prefix_boost = prefix_match_bonus(&query_text, &skill.name);
results.push(QueryResult::from(
InlineItem::from_skill(&skill, app)
.with_name_match_result(fuzzy_result.name_match_result)
.with_description_match_result(fuzzy_result.description_match_result)
.with_compact_layout(self.is_cloud_mode_v2)
.with_score(
OrderedFloat(score) * SCORE_MULTIPLIER
+ OrderedFloat(prefix_boost) * SCORE_MULTIPLIER
+ OrderedFloat(1. / skill.name.len() as f64),
),
));
}
}
}
Ok(results)
}
}
/// Computes a bonus score for slash command matches where the query is a prefix
/// of the command name. This ensures closer matches (e.g., "new" → "/new") rank
/// above longer fuzzy matches (e.g., "new" → "/figma-create-new-file").
///
/// Returns a value in `[0.0, 100.0]` based on the query's coverage of the name.
/// An exact match yields the maximum bonus of 100; partial prefix matches yield
/// a proportionally smaller bonus.
fn prefix_match_bonus(query: &str, name: &str) -> f64 {
let name_lower = name.to_lowercase();
let name_stripped = name_lower.strip_prefix('/').unwrap_or(&name_lower);
if name_stripped.starts_with(query) {
// coverage = 1.0 for exact match, smaller for partial prefix match.
let coverage = query.len() as f64 / name_stripped.len() as f64;
coverage * 100.0
} else {
0.0
}
}
#[derive(Debug, Clone, Copy)]
pub struct UpdatedActiveCommands;
impl Entity for SlashCommandDataSource {
type Event = UpdatedActiveCommands;
}
#[derive(Debug, Clone)]
pub struct InlineItem {
pub action: AcceptSlashCommandOrSavedPrompt,
pub icon_path: &'static str,
pub name: String,
pub description: Option<String>,
pub font_family: FamilyId,
pub name_match_result: Option<FuzzyMatchResult>,
pub description_match_result: Option<FuzzyMatchResult>,
pub score: OrderedFloat<f64>,
pub compact_layout: bool,
}
impl InlineItem {
fn from_slash_command(
command_id: &SlashCommandId,
command: &StaticCommand,
app: &AppContext,
) -> Self {
let appearance = Appearance::as_ref(app);
Self {
action: AcceptSlashCommandOrSavedPrompt::SlashCommand { id: *command_id },
icon_path: command.icon_path,
name: command.name.to_owned(),
description: Some(command.description.to_owned()),
font_family: appearance.monospace_font_family(),
name_match_result: None,
description_match_result: None,
score: OrderedFloat(f64::MIN),
compact_layout: false,
}
}
pub(crate) fn from_saved_prompt(
saved_prompt: &crate::workflows::CloudWorkflow,
app: &AppContext,
) -> Self {
let appearance = Appearance::as_ref(app);
Self {
action: AcceptSlashCommandOrSavedPrompt::SavedPrompt {
id: saved_prompt.id,
},
icon_path: "bundled/svg/prompt.svg",
name: saved_prompt.model().data.name().to_owned(),
description: None,
font_family: appearance.ui_font_family(),
name_match_result: None,
description_match_result: None,
score: OrderedFloat(f64::MIN),
compact_layout: false,
}
}
pub(super) fn from_skill(skill: &SkillDescriptor, app: &AppContext) -> Self {
let appearance = Appearance::handle(app).as_ref(app);
// Use icon_override if set (e.g. Figma skills), otherwise derive from provider.
let icon = if let Some(override_icon) = skill.icon_override {
override_icon
} else {
match skill.provider {
SkillProvider::Warp => WarpIcon::Warp,
SkillProvider::Claude => WarpIcon::ClaudeLogo,
SkillProvider::Codex => WarpIcon::OpenAILogo,
SkillProvider::Gemini => WarpIcon::GeminiLogo,
SkillProvider::Droid => WarpIcon::DroidLogo,
SkillProvider::OpenCode => WarpIcon::OpenCodeLogo,
_ => WarpIcon::Warp,
}
};
Self {
action: AcceptSlashCommandOrSavedPrompt::Skill {
reference: skill.reference.clone(),
name: skill.name.clone(),
},
icon_path: icon.into(),
name: format!("/{}", &skill.name),
description: Some(skill.description.clone()),
font_family: appearance.monospace_font_family(),
name_match_result: None,
description_match_result: None,
score: OrderedFloat(f64::MIN),
compact_layout: false,
}
}
fn with_name_match_result(mut self, result: Option<FuzzyMatchResult>) -> Self {
self.name_match_result = result;
self
}
fn with_description_match_result(mut self, result: Option<FuzzyMatchResult>) -> Self {
self.description_match_result = result;
self
}
fn with_score(mut self, score: OrderedFloat<f64>) -> Self {
self.score = score;
self
}
pub(crate) fn with_compact_layout(mut self, compact: bool) -> Self {
self.compact_layout = compact;
self
}
}
#[cfg(test)]
#[path = "mod_test.rs"]
mod tests;