mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-06 02:47:56 +00:00
Fix duplicate mention suggestion (#2528)
improve deduplication logic in getContextMenuOptions to handle context menu item keys more accurately
This commit is contained in:
parent
2c8304ea31
commit
e9980bcfa9
1 changed files with 11 additions and 2 deletions
|
|
@ -246,8 +246,17 @@ export function getContextMenuOptions(
|
|||
const seen = new Set()
|
||||
const deduped = allItems.filter((item) => {
|
||||
// Normalize paths for deduplication by ensuring leading slashes
|
||||
const normalizedValue = item.value && !item.value.startsWith("/") ? `/${item.value}` : item.value
|
||||
const key = `${item.type}-${normalizedValue}`
|
||||
const normalizedValue = item.value
|
||||
let key = ""
|
||||
if (
|
||||
item.type === ContextMenuOptionType.File ||
|
||||
item.type === ContextMenuOptionType.Folder ||
|
||||
item.type === ContextMenuOptionType.OpenedFile
|
||||
) {
|
||||
key = normalizedValue!
|
||||
} else {
|
||||
key = `${item.type}-${normalizedValue}`
|
||||
}
|
||||
if (seen.has(key)) return false
|
||||
seen.add(key)
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue