/
outbreak
/
kilocode
Обзор
Документация
Войти
/
outbreak
/
kilocode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
webview-ui/src/utils/formatPathTooltip.ts
28 строк
887 B
Daniel
feat: add file path tooltips with centralized PathTooltip component (#9030)
05 ноя 2025, 05:59
Не верифицирован
05 ноя 2025, 05:59
f1caf3f
Код
Авторство
О чём код?
import { removeLeadingNonAlphanumeric } from "./removeLeadingNonAlphanumeric" /** * Formats a file path for display in tooltips with consistent formatting. * * @param path - The file path to format * @param additionalContent - Optional additional content to append (e.g., line snippets, reasons) * @returns Formatted string ready for tooltip display * * @example * formatPathTooltip("/src/components/MyComponent.tsx") * // Returns: "src/components/MyComponent.tsx" + U+200E * * @example * formatPathTooltip("/src/utils/helper.ts", ":42-45") * // Returns: "src/utils/helper.ts:42-45" + U+200E */ export function formatPathTooltip(path?: string, additionalContent?: string): string { if (!path) return "" const formattedPath = removeLeadingNonAlphanumeric(path) + "\u200E" if (additionalContent) { return formattedPath + additionalContent } return formattedPath }