Skip to content

Commit a7bf401

Browse files
committed
Refactor: Replace path.basename with custom getBasename function in getContextMenuOptions
1 parent 3fc4ce9 commit a7bf401

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { mentionRegex } from "../../../src/shared/context-mentions"
22
import { Fzf } from "fzf"
33
import { ModeConfig } from "../../../src/shared/modes"
4-
import * as path from "path"
4+
5+
function getBasename(filepath: string): string {
6+
return filepath.split("/").pop() || filepath
7+
}
58

69
export interface SearchResult {
710
path: string
@@ -235,7 +238,7 @@ export function getContextMenuOptions(
235238
return {
236239
type: result.type === "folder" ? ContextMenuOptionType.Folder : ContextMenuOptionType.File,
237240
value: formattedPath,
238-
label: result.label || path.basename(result.path),
241+
label: result.label || getBasename(result.path),
239242
description: formattedPath,
240243
}
241244
})

0 commit comments

Comments
 (0)