Skip to content

Commit eb2b67d

Browse files
samhvw8mehmetsunkur
authored andcommitted
Fix/remove path lib webview (RooCodeInc#2529)
1 parent 02224a9 commit eb2b67d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

webview-ui/src/utils/context-mentions.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { mentionRegex } from "@roo/shared/context-mentions"
22
import { Fzf } from "fzf"
33
import { ModeConfig } from "@roo/shared/modes"
4-
import * as path from "path"
4+
55
import { escapeSpaces } from "./path-mentions"
66

77
export interface SearchResult {
88
path: string
99
type: "file" | "folder"
1010
label?: string
1111
}
12+
13+
function getBasename(filepath: string): string {
14+
return filepath.split("/").pop() || filepath
15+
}
16+
1217
export function insertMention(
1318
text: string,
1419
position: number,
@@ -254,7 +259,7 @@ export function getContextMenuOptions(
254259

255260
// For display purposes, we don't escape spaces in the label or description
256261
const displayPath = formattedPath
257-
const displayName = result.label || path.basename(result.path)
262+
const displayName = result.label || getBasename(result.path)
258263

259264
// We don't need to escape spaces here because the insertMention function
260265
// will handle that when the user selects a suggestion

0 commit comments

Comments
 (0)