Managing SourceCraft Code Assistant chat context in Visual Studio Code
Warning
This page describes chat context features in Visual Studio Code. To learn about the chat context features in the JetBrains IDE, see this page.
Context mentions are a powerful way to give Code Assistant specific information about your project for more accurate and efficient task execution. You can use mentions to reference files, folders, VS Code Problems, and Git commits. All context mentions start with @.
Mention types
| Mention type | Format | Description | Usage example |
|---|---|---|---|
| File | @/path/to/file.ts |
Includes the file's contents in the prompt context | Explain the function in @/src/utils.ts |
| Folder | @/path/to/folder |
Includes the contents of all files residing in the folder (non-recursively) | Analyze the code in @/src/components |
| Problems | @problems |
Includes diagnostics from the VS Code Problems panel | @problems Fix all errors in my code |
| Terminal | @terminal |
Includes the most recent terminal command and its output | Fix the errors displayed in @terminal |
| Git Commits | @a1b2c3d |
References a specific commit by its hash | What changed in commit @a1b2c3d? |
| URL | @https://example.com |
Imports website contents | Summarize @https://sourcecraft.dev/portal/code-assistant/ |
File mention features
| Feature | Details |
|---|---|
| Format | @/path/to/file.tsAlways start with / relative to the workspace root. |
| Extracted data | Full file contents with line numbers. |
| Supported files | Text files, PDF and DOCX (text-extractable formats). |
| Allowed use | Initial prompts, follow-up clarifications, and subsequent messages. |
| Constraints | Very large files may be truncated. Binary files are not supported. |
How to use mentions
-
In the chat input field, type
@to open the dropdown with suggested mentions. -
Continue typing to filter suggestions or use arrow keys for navigation.
-
Select the mention you need by pressing Enter or using your mouse.
You can use multiple mentions in a single prompt, e.g.,
Fix @problems in @/src/component.ts.The dropdown automatically suggests:
- Recently opened files.
- Visible folders.
- Recent Git commits.
- Special keywords:
problems,terminal,git-changes. - All currently opened files, regardless of ignore settings or directory filters.
Ignoring files
| Behavior | Description |
|---|---|
Bypassing .codeassistantignore |
File and folder mentions ignore .codeassistantignore checks when fetching content for context. If you explicitly mention an ignored file, its content will be included in the context. |
Bypassing .gitignore |
Similarly, mentions of files and folders disregard .gitignore rules when fetching file contents. |
| Accounting for Git commands | Git-related mentions, e.g., @git-changes or @commit-hash, account for .gitignore, as they depend on Git commands. |