Skip to content

Commit 643090c

Browse files
committed
fix: add tooltips to display full file paths on truncated text in chatview
Add tooltips that show the complete file path when hovering over truncated file names in file editing/reading notices throughout the chat interface. Changes: - Add StandardTooltip components to file path displays in CodeAccordian, ChatRow, and BatchFilePermission components - Override default tooltip styles with `text-wrap` to prevent excessive whitespace from text-balance behavior - Use responsive max-width `max-w-[min(300px,100vw)]` to ensure tooltips adapt to narrow panel widths and prevent content cutoff - Leverage existing `break-words` CSS to allow natural line breaking at path separators The added tooltips: - Display full file paths even when truncated in the UI - Wrap text naturally at path separators without excessive whitespace - Adapt responsively to panel width (max 300px on wide panels, 100vw on narrow) - Maintain consistent behavior with other tooltips in the extension Files modified: - webview-ui/src/components/common/CodeAccordian.tsx - webview-ui/src/components/chat/ChatRow.tsx - webview-ui/src/components/chat/BatchFilePermission.tsx
1 parent 270dce5 commit 643090c

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

webview-ui/src/components/chat/BatchFilePermission.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { memo } from "react"
33
import { ToolUseBlock, ToolUseBlockHeader } from "../common/ToolUseBlock"
44
import { vscode } from "@src/utils/vscode"
55
import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanumeric"
6+
import { StandardTooltip } from "../ui/standard-tooltip"
67

78
interface FilePermissionItem {
89
path: string
@@ -35,10 +36,12 @@ export const BatchFilePermission = memo(({ files = [], onPermissionResponse, ts
3536
<ToolUseBlockHeader
3637
onClick={() => vscode.postMessage({ type: "openFile", text: file.content })}>
3738
{file.path?.startsWith(".") && <span>.</span>}
38-
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
39-
{removeLeadingNonAlphanumeric(file.path ?? "") + "\u200E"}
40-
{file.lineSnippet && ` ${file.lineSnippet}`}
41-
</span>
39+
<StandardTooltip content={file.path} side="top" align="start" className="text-wrap max-w-[min(300px,100vw)]">
40+
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
41+
{removeLeadingNonAlphanumeric(file.path ?? "") + "\u200E"}
42+
{file.lineSnippet && ` ${file.lineSnippet}`}
43+
</span>
44+
</StandardTooltip>
4245
<div className="flex-grow"></div>
4346
<span className="codicon codicon-link-external text-[13.5px] my-[1px]" />
4447
</ToolUseBlockHeader>

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import {
6363
MessageCircle,
6464
} from "lucide-react"
6565
import { cn } from "@/lib/utils"
66+
import { StandardTooltip } from "../ui/standard-tooltip"
6667

6768
interface ChatRowProps {
6869
message: ClineMessage
@@ -600,10 +601,12 @@ export const ChatRowContent = ({
600601
className="group"
601602
onClick={() => vscode.postMessage({ type: "openFile", text: tool.content })}>
602603
{tool.path?.startsWith(".") && <span>.</span>}
603-
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
604-
{removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
605-
{tool.reason}
606-
</span>
604+
<StandardTooltip content={tool.path} side="top" align="start" className="text-wrap max-w-[min(300px,100vw)]">
605+
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
606+
{removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
607+
{tool.reason}
608+
</span>
609+
</StandardTooltip>
607610
<div style={{ flexGrow: 1 }}></div>
608611
<SquareArrowOutUpRight
609612
className="w-4 shrink-0 codicon codicon-link-external opacity-0 group-hover:opacity-100 transition-opacity"

webview-ui/src/components/common/CodeAccordian.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanu
66

77
import { ToolUseBlock, ToolUseBlockHeader } from "./ToolUseBlock"
88
import CodeBlock from "./CodeBlock"
9+
import { StandardTooltip } from "../ui/standard-tooltip"
910

1011
interface CodeAccordianProps {
1112
path?: string
@@ -44,7 +45,9 @@ const CodeAccordian = ({
4445
{header ? (
4546
<div className="flex items-center">
4647
<span className="codicon codicon-server mr-1.5"></span>
47-
<span className="whitespace-nowrap overflow-hidden text-ellipsis mr-2">{header}</span>
48+
<StandardTooltip content={header} side="top" align="start" className="text-wrap max-w-[min(300px,100vw)]">
49+
<span className="whitespace-nowrap overflow-hidden text-ellipsis mr-2">{header}</span>
50+
</StandardTooltip>
4851
</div>
4952
) : isFeedback ? (
5053
<div className="flex items-center">
@@ -56,9 +59,11 @@ const CodeAccordian = ({
5659
) : (
5760
<>
5861
{path?.startsWith(".") && <span>.</span>}
59-
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
60-
{removeLeadingNonAlphanumeric(path ?? "") + "\u200E"}
61-
</span>
62+
<StandardTooltip content={path} side="top" align="start" className="text-wrap max-w-[min(300px,100vw)]">
63+
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
64+
{removeLeadingNonAlphanumeric(path ?? "") + "\u200E"}
65+
</span>
66+
</StandardTooltip>
6267
</>
6368
)}
6469
<div className="flex-grow-1" />

0 commit comments

Comments
 (0)