File Mentions
File mentions let you pull any file from your workspace directly into your conversation with Cline. No more copying and pasting code snippets - just type @/
and point to the file you need help with.
When you type @/
in the chat, Cline shows your workspace files. Navigate through folders, select the file you want, and it’s instantly available to Cline - complete with all imports, related functions, and surrounding context.
I use file mentions constantly when debugging. Instead of trying to figure out which parts of my code to copy over, I just reference the file directly:
This gives Cline everything it needs - the error message, the component code, and the API endpoint - all without me having to copy anything. Cline can see imports, dependencies, and all the surrounding context that might be causing the issue.
File mentions shine when you’re dealing with complex bugs that span multiple files. Before, I’d have to carefully copy each relevant file, making sure I didn’t miss anything important. Now I just reference each file with @/
and Cline gets the complete picture.
Next time you’re stuck on a problem, try using file mentions instead of copying code. You’ll save time and get better answers because Cline has all the context it needs.
How It Works Under the Hood
When you use a file mention in your message, here’s what happens behind the scenes:
- When you send your message, Cline detects the
@/path/to/file
pattern in your text - The extension resolves the file path relative to your workspace root
- It checks if the file is binary (like an image) or text-based
- For text files, it reads the complete file content
- The file content is appended to your message in a structured format:
- This enhanced message with the embedded file content is sent to the AI
- The AI can now “see” the complete file content as if you had copied and pasted it
This seamless process happens automatically whenever you use a file mention, giving the AI full context without you having to manually copy anything.