Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
e.preventDefault()
setIsDraggingOver(false)

const text = e.dataTransfer.getData("application/vnd.code.uri-list")
const textFieldList = e.dataTransfer.getData("text")
const textUriList = e.dataTransfer.getData("application/vnd.code.uri-list")
// When textFieldList is empty, it may attempt to use textUriList obtained from drag-and-drop tabs; if not empty, it will use textFieldList.
const text = textFieldList || textUriList
if (text) {
// Split text on newlines to handle multiple files
const lines = text.split(/\r?\n/).filter((line) => line.trim() !== "")
Expand Down
16 changes: 14 additions & 2 deletions webview-ui/src/utils/path-mentions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@
* @returns A mention-friendly path
*/
export function convertToMentionPath(path: string, cwd?: string): string {
// Strip file:// protocol if present
let pathWithoutProtocol = path.startsWith("file://") ? path.substring(7) : path
// Strip file:// or vscode-remote:// protocol if present
let pathWithoutProtocol = path

if (path.startsWith("file://")) {
pathWithoutProtocol = path.substring(7)
} else if (path.startsWith("vscode-remote://")) {
const protocolStripped = path.substring("vscode-remote://".length)
const firstSlashIndex = protocolStripped.indexOf("/")
if (firstSlashIndex !== -1) {
pathWithoutProtocol = protocolStripped.substring(firstSlashIndex + 1)
} else {
pathWithoutProtocol = ""
}
}

try {
pathWithoutProtocol = decodeURIComponent(pathWithoutProtocol)
Expand Down