mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix inconsistent descriptions in slash commands (#5388)
This commit is contained in:
parent
f96021fa6b
commit
7ae74404f4
2 changed files with 10 additions and 2 deletions
|
|
@ -6,6 +6,14 @@ import { mentionRegex } from "@roo/context-mentions"
|
|||
|
||||
import { escapeSpaces } from "./path-mentions"
|
||||
|
||||
/**
|
||||
* Gets the description for a mode, prioritizing description > whenToUse > roleDefinition
|
||||
* and taking only the first line
|
||||
*/
|
||||
function getModeDescription(mode: ModeConfig): string {
|
||||
return (mode.description || mode.whenToUse || mode.roleDefinition).split("\n")[0]
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
path: string
|
||||
type: "file" | "folder"
|
||||
|
|
@ -137,13 +145,13 @@ export function getContextMenuOptions(
|
|||
type: ContextMenuOptionType.Mode,
|
||||
value: result.item.original.slug,
|
||||
label: result.item.original.name,
|
||||
description: (result.item.original.whenToUse || result.item.original.roleDefinition).split("\n")[0],
|
||||
description: getModeDescription(result.item.original),
|
||||
}))
|
||||
: modes.map((mode) => ({
|
||||
type: ContextMenuOptionType.Mode,
|
||||
value: mode.slug,
|
||||
label: mode.name,
|
||||
description: (mode.description || mode.whenToUse || mode.roleDefinition).split("\n")[0],
|
||||
description: getModeDescription(mode),
|
||||
}))
|
||||
|
||||
return matchingModes.length > 0 ? matchingModes : [{ type: ContextMenuOptionType.NoResults }]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue