|
| 1 | +# Cline Mentions Feature Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The mentions feature is a powerful capability that allows you to reference various resources in your conversations with Cline using the "@" symbol. This includes file contents, directory structures, webpage URLs, VSCode diagnostic information, terminal output, Git change status, and more - all easily incorporated into your conversations. |
| 6 | + |
| 7 | +By using this feature, Cline can gain more accurate context and provide more relevant assistance for your tasks. |
| 8 | + |
| 9 | +## Basic Syntax |
| 10 | + |
| 11 | +Mentions always start with the "@" symbol, followed by the path or identifier of the resource you want to reference: |
| 12 | + |
| 13 | +``` |
| 14 | +@resource_identifier |
| 15 | +``` |
| 16 | + |
| 17 | +You can place mentions anywhere in your user messages, and Cline will automatically retrieve the referenced content. |
| 18 | + |
| 19 | +## Supported Mention Types |
| 20 | + |
| 21 | +### 1. File References |
| 22 | + |
| 23 | +To reference file contents, use `@/` followed by the relative path within your project: |
| 24 | + |
| 25 | +``` |
| 26 | +@/path/to/file.js |
| 27 | +``` |
| 28 | + |
| 29 | +**Example:** |
| 30 | +``` |
| 31 | +Please analyze the implementation in @/src/components/Button.tsx |
| 32 | +``` |
| 33 | + |
| 34 | +In this example, Cline automatically retrieves the contents of Button.tsx and uses it to perform the analysis. |
| 35 | + |
| 36 | +### 2. Directory References |
| 37 | + |
| 38 | +To reference directory contents, use `@/` followed by the relative path of the directory, ending with a trailing `/`: |
| 39 | + |
| 40 | +``` |
| 41 | +@/path/to/directory/ |
| 42 | +``` |
| 43 | + |
| 44 | +**Example:** |
| 45 | +``` |
| 46 | +What components are available in the @/src/components/ directory? |
| 47 | +``` |
| 48 | + |
| 49 | +In this example, Cline retrieves a listing of the components directory and its contents. |
| 50 | + |
| 51 | +### 3. URL References |
| 52 | + |
| 53 | +To reference web page contents, use `@` followed by the URL: |
| 54 | + |
| 55 | +``` |
| 56 | +@https://example.com |
| 57 | +``` |
| 58 | + |
| 59 | +**Example:** |
| 60 | +``` |
| 61 | +Please parse the JSON response from @https://api.github.com/users/octocat |
| 62 | +``` |
| 63 | + |
| 64 | +In this example, Cline fetches the response from the GitHub API and analyzes the JSON. |
| 65 | + |
| 66 | +### 4. Diagnostic References |
| 67 | + |
| 68 | +To reference VSCode diagnostic information (errors and warnings) in the current workspace, use `@problems`: |
| 69 | + |
| 70 | +``` |
| 71 | +@problems |
| 72 | +``` |
| 73 | + |
| 74 | +**Example:** |
| 75 | +``` |
| 76 | +Check @problems and tell me which errors I should prioritize fixing |
| 77 | +``` |
| 78 | + |
| 79 | +In this example, Cline retrieves the current errors and warnings from your workspace and identifies high-priority issues. |
| 80 | + |
| 81 | +### 5. Terminal Output References |
| 82 | + |
| 83 | +To reference the latest terminal output, use `@terminal`: |
| 84 | + |
| 85 | +``` |
| 86 | +@terminal |
| 87 | +``` |
| 88 | + |
| 89 | +**Example:** |
| 90 | +``` |
| 91 | +Please identify the cause of the error in the @terminal output |
| 92 | +``` |
| 93 | + |
| 94 | +In this example, Cline examines the latest terminal output and analyzes the error's cause. |
| 95 | + |
| 96 | +### 6. Git Working Directory References |
| 97 | + |
| 98 | +To reference the current Git working directory change status, use `@git-changes`: |
| 99 | + |
| 100 | +``` |
| 101 | +@git-changes |
| 102 | +``` |
| 103 | + |
| 104 | +**Example:** |
| 105 | +``` |
| 106 | +Review the @git-changes and summarize the important changes that should be committed |
| 107 | +``` |
| 108 | + |
| 109 | +In this example, Cline retrieves the list of changed files in the current Git working directory and identifies candidates for commit. |
| 110 | + |
| 111 | +### 7. Git Commit References |
| 112 | + |
| 113 | +To reference information about a specific Git commit, use `@` followed by the commit hash: |
| 114 | + |
| 115 | +``` |
| 116 | +@commit_hash |
| 117 | +``` |
| 118 | + |
| 119 | +**Example:** |
| 120 | +``` |
| 121 | +Analyze the commit @abcd123 and explain what changes were made |
| 122 | +``` |
| 123 | + |
| 124 | +In this example, Cline retrieves information about the specified commit hash and analyzes the changes made in that commit. |
| 125 | + |
| 126 | +## Usage Scenarios |
| 127 | + |
| 128 | +### Code Review |
| 129 | + |
| 130 | +``` |
| 131 | +Check @/src/components/Form.jsx and suggest improvements from a performance perspective. Also, if there are any @problems, please suggest how to fix them. |
| 132 | +``` |
| 133 | + |
| 134 | +### Debugging Assistance |
| 135 | + |
| 136 | +``` |
| 137 | +My npm install failed. Please examine the @terminal output and suggest a solution to the problem. |
| 138 | +``` |
| 139 | + |
| 140 | +### Project Analysis |
| 141 | + |
| 142 | +``` |
| 143 | +Analyze the code in the @/src/models/ directory and explain the relationships between the data models. Also, tell me how the utility functions in @/src/utils/ are used with these models. |
| 144 | +``` |
| 145 | + |
| 146 | +### Code Generation |
| 147 | + |
| 148 | +``` |
| 149 | +Create a new Input.tsx component using the same design language as @/src/components/Button.tsx |
| 150 | +``` |
| 151 | + |
| 152 | +### Version Control Integration |
| 153 | + |
| 154 | +``` |
| 155 | +Review the @git-changes and suggest a commit message for the feature I'm working on. |
| 156 | +``` |
| 157 | + |
| 158 | +## Combining Multiple Mentions |
| 159 | + |
| 160 | +You can combine multiple mentions to provide more complex context: |
| 161 | + |
| 162 | +``` |
| 163 | +There seems to be a bug in @/src/api/users.js. Please check @problems and @terminal to identify and fix the issue. |
| 164 | +``` |
| 165 | + |
| 166 | +## Limitations and Considerations |
| 167 | + |
| 168 | +1. **Large Files**: Referencing very large files may take time to process and could consume a significant amount of tokens. |
| 169 | + |
| 170 | +2. **Binary Files**: Binary files (such as images) will not be properly processed and will show a "Binary file" message. |
| 171 | + |
| 172 | +3. **Directory Structure**: Directory references will only show top-level files and directories, not recursively showing the contents of subdirectories. |
| 173 | + |
| 174 | +4. **URL Limitations**: Some websites may block automated crawling, which could prevent accurate content retrieval. |
| 175 | + |
| 176 | +5. **Path Syntax**: File paths or URLs with special characters (such as spaces) may not be recognized correctly. |
| 177 | + |
| 178 | +## Troubleshooting |
| 179 | + |
| 180 | +### Mentions Not Recognized |
| 181 | + |
| 182 | +If your mentions aren't being recognized correctly, check that: |
| 183 | + |
| 184 | +- There's no space after the `@` symbol |
| 185 | +- File paths are accurate (case-sensitive) |
| 186 | +- URLs include the full format (with `https://`) |
| 187 | + |
| 188 | +### Content Not Retrieved |
| 189 | + |
| 190 | +If the content of referenced resources can't be retrieved: |
| 191 | + |
| 192 | +- Verify the file exists |
| 193 | +- Ensure you have access permissions for the file |
| 194 | +- Check that the file isn't too large or the URL too complex |
| 195 | + |
| 196 | +### Performance Issues |
| 197 | + |
| 198 | +If mention processing is slow: |
| 199 | + |
| 200 | +- Reference smaller files or specific file sections |
| 201 | +- Reduce the number of mentions used at once |
| 202 | + |
| 203 | +## Conclusion |
| 204 | + |
| 205 | +Mastering the mentions feature makes your communication with Cline more efficient. By providing appropriate context, Cline can deliver more accurate assistance, significantly improving your development workflow. |
0 commit comments