@@ -16,6 +16,7 @@ import { vscode } from "../../utils/vscode"
1616import { WebviewMessage } from "../../../../src/shared/WebviewMessage"
1717import { Mode , getAllModes } from "../../../../src/shared/modes"
1818import { CaretIcon } from "../common/CaretIcon"
19+ import { convertToMentionPath } from "../../utils/path-mentions"
1920
2021interface ChatTextAreaProps {
2122 inputValue : string
@@ -50,7 +51,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
5051 } ,
5152 ref ,
5253 ) => {
53- const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState ( )
54+ const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes, cwd } = useExtensionState ( )
5455 const [ gitCommits , setGitCommits ] = useState < any [ ] > ( [ ] )
5556 const [ showDropdown , setShowDropdown ] = useState ( false )
5657
@@ -589,18 +590,24 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
589590 const files = Array . from ( e . dataTransfer . files )
590591 const text = e . dataTransfer . getData ( "text" )
591592 if ( text ) {
592- const newValue = inputValue . slice ( 0 , cursorPosition ) + text + inputValue . slice ( cursorPosition )
593+ // Convert the path to a mention-friendly format
594+ const mentionText = convertToMentionPath ( text , cwd )
595+
596+ const newValue =
597+ inputValue . slice ( 0 , cursorPosition ) + mentionText + " " + inputValue . slice ( cursorPosition )
593598 setInputValue ( newValue )
594- const newCursorPosition = cursorPosition + text . length
599+ const newCursorPosition = cursorPosition + mentionText . length + 1
595600 setCursorPosition ( newCursorPosition )
596601 setIntendedCursorPosition ( newCursorPosition )
597602 return
598603 }
604+
599605 const acceptedTypes = [ "png" , "jpeg" , "webp" ]
600606 const imageFiles = files . filter ( ( file ) => {
601607 const [ type , subtype ] = file . type . split ( "/" )
602608 return type === "image" && acceptedTypes . includes ( subtype )
603609 } )
610+
604611 if ( ! shouldDisableImages && imageFiles . length > 0 ) {
605612 const imagePromises = imageFiles . map ( ( file ) => {
606613 return new Promise < string | null > ( ( resolve ) => {
0 commit comments