@@ -50,7 +50,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
5050 } ,
5151 ref ,
5252 ) => {
53- const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState ( )
53+ const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes, cwd } = useExtensionState ( )
5454 const [ gitCommits , setGitCommits ] = useState < any [ ] > ( [ ] )
5555 const [ showDropdown , setShowDropdown ] = useState ( false )
5656
@@ -589,18 +589,35 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
589589 const files = Array . from ( e . dataTransfer . files )
590590 const text = e . dataTransfer . getData ( "text" )
591591 if ( text ) {
592- const newValue = inputValue . slice ( 0 , cursorPosition ) + text + inputValue . slice ( cursorPosition )
592+ let mentionText = text
593+ const normalizedText = text . replace ( / \\ / g, "/" )
594+ const normalizedCwd = cwd ? cwd . replace ( / \\ / g, "/" ) : ""
595+
596+ // Always use case-insensitive comparison for path matching
597+ if ( normalizedCwd ) {
598+ const lowerText = normalizedText . toLowerCase ( )
599+ const lowerCwd = normalizedCwd . toLowerCase ( )
600+
601+ if ( lowerText . startsWith ( lowerCwd ) ) {
602+ mentionText = "@" + normalizedText . substring ( normalizedCwd . length )
603+ }
604+ }
605+
606+ const newValue =
607+ inputValue . slice ( 0 , cursorPosition ) + mentionText + " " + inputValue . slice ( cursorPosition )
593608 setInputValue ( newValue )
594- const newCursorPosition = cursorPosition + text . length
609+ const newCursorPosition = cursorPosition + mentionText . length + 1
595610 setCursorPosition ( newCursorPosition )
596611 setIntendedCursorPosition ( newCursorPosition )
597612 return
598613 }
614+
599615 const acceptedTypes = [ "png" , "jpeg" , "webp" ]
600616 const imageFiles = files . filter ( ( file ) => {
601617 const [ type , subtype ] = file . type . split ( "/" )
602618 return type === "image" && acceptedTypes . includes ( subtype )
603619 } )
620+
604621 if ( ! shouldDisableImages && imageFiles . length > 0 ) {
605622 const imagePromises = imageFiles . map ( ( file ) => {
606623 return new Promise < string | null > ( ( resolve ) => {
0 commit comments