You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.**`GetSymbolInfo_CppTools`** - Find symbol definitions and get type details
10
+
1.**`GetSymbolInfo_CppTools`** - Find symbol definitions and get type information
11
11
2.**`GetSymbolReferences_CppTools`** - Find ALL references to a symbol
12
12
3.**`GetSymbolCallHierarchy_CppTools`** - Analyze function call relationships
13
13
14
14
---
15
15
16
16
## Mandatory Tool Usage Rules
17
17
18
-
### Rule 1: ALWAYS Use GetSymbolReferences_CppTools for Symbol Usages
18
+
### Rule 1: Prefer GetSymbolReferences_CppTools as the default for locating C/C++ Symbol Usages
19
19
20
-
**NEVER** rely on manual code inspection, `vscode_listCodeUsages`, `grep_search`, or `read_file`to find where a symbol is used.
20
+
**DO NOT** rely on text-based search tools such as `vscode_listCodeUsages`, `grep_search`, or `read_file`. Only if GetSymbolReferences_CppTools is unavailable, fails, or appears incomplete, resort to these text-based search tools as a fallback.
- Renaming any symbol (function, variable, class, method, etc.)
23
+
- Any task involving "find all references/usages/uses"
25
24
- Changing function signatures
26
25
- Refactoring code
27
26
- Understanding symbol impact
28
-
- Finding all call sites
29
27
- Identifying usage patterns
30
-
- Any task involving "find all uses/usages/references/calls"
31
28
32
29
**Why**: `GetSymbolReferences_CppTools` uses C++ IntelliSense and understands:
33
-
34
-
- Overloaded functions
35
-
- Template instantiations
30
+
- Differentiating between overloaded functions
31
+
- Differentiating between template instantiations
36
32
- Qualified vs unqualified names
37
33
- Member function calls
38
34
- Inherited member usage
39
-
- Preprocessor-conditional code
35
+
- Preprocessor conditionals for the active configuration
40
36
41
37
Text search tools will miss these or produce false positives.
42
38
@@ -59,9 +55,7 @@ Before modifying any function signature, **ALWAYS** call `GetSymbolCallHierarchy
59
55
Before working with unfamiliar code, **ALWAYS** call `GetSymbolInfo_CppTools` to:
60
56
61
57
- Find where a symbol is defined
62
-
- Understand class/struct memory layout
63
58
- Get type information
64
-
- Locate declarations
65
59
66
60
**NEVER** assume you know what a symbol is without checking.
67
61
@@ -101,27 +95,12 @@ Start with minimal information and add more only if needed:
101
95
102
96
1.**First attempt**: Symbol name only
103
97
2.**If ambiguous**: Symbol name + file path
104
-
3.**If still ambiguous**: Symbol name + file path + line number (after using `read_file`)
98
+
3.**If still ambiguous**: Symbol name + file path + line number (after using `read_file` workflow mentioned above)
105
99
106
100
---
107
101
108
102
## Common Workflows
109
103
110
-
### Renaming a Symbol
111
-
112
-
```
113
-
CORRECT workflow:
114
-
1. Call GetSymbolReferences_CppTools with symbol name (and file path if available)
115
-
2. Review ALL references returned
116
-
3. Update symbol at definition location
117
-
4. Update symbol at ALL reference locations
118
-
119
-
INCORRECT workflow:
120
-
❌ Using vscode_listCodeUsages or grep_search to find usages
121
-
❌ Manually inspecting a few files
122
-
❌ Assuming you know all the usages
123
-
```
124
-
125
104
### Changing a Function Signature
126
105
127
106
```
@@ -143,8 +122,8 @@ INCORRECT workflow:
143
122
```
144
123
CORRECT workflow:
145
124
1. Call GetSymbolInfo_CppTools on key types/functions to understand definitions
146
-
3. Call GetSymbolCallHierarchy_CppTools with callsFrom=true to understand what a function does
147
-
4. Call GetSymbolCallHierarchy_CppTools with callsFrom=false to understand where a function is used
125
+
2. Call GetSymbolCallHierarchy_CppTools with callsFrom=true to understand what a function does
126
+
3. Call GetSymbolCallHierarchy_CppTools with callsFrom=false to understand where a function is used
148
127
149
128
INCORRECT workflow:
150
129
❌ Reading code manually without tool assistance
@@ -236,16 +215,16 @@ This is NOT an error - it means:
236
215
237
216
- ✅ Call `GetSymbolReferences_CppTools` for ANY symbol usage search
238
217
- ✅ Call `GetSymbolCallHierarchy_CppTools` before function signature changes
239
-
- ✅ Use `read_file` to find line numbers before specifying them
218
+
- ✅ Use `read_file` to find line numbers before specifying them### Rule 1: Prefer GetSymbolReferences_CppTools as the default for locating C/C++ Symbol Usages
219
+
- ✅ Prefer C++ tools as the default. Rely on text-based search tools only as a fallback if C++ tools are unavailable, fail, or appear incomplete.
240
220
- ✅ Provide absolute file paths when available
241
221
- ✅ Follow error message instructions exactly
242
222
- ✅ Trust tool results over manual inspection
243
223
- ✅ Use minimal parameters first, add more if needed
244
224
- ✅ Remember line numbers are 1-based
245
225
246
226
### DO NOT:
247
-
248
-
- ❌ Use `vscode_listCodeUsages`, `grep_search`, or `read_file` to find symbol usages
227
+
- ❌ Rely on text-based search tools such as `vscode_listCodeUsages`, `grep_search`, or `read_file` to find symbol usages
249
228
- ❌ Manually inspect code to find references
250
229
- ❌ Guess line numbers
251
230
- ❌ Assume symbol uniqueness without checking
@@ -259,26 +238,7 @@ This is NOT an error - it means:
259
238
260
239
## Examples of Correct Usage
261
240
262
-
### Example 1: User asks to rename a function
263
-
264
-
```
265
-
User: "Rename the function ProcessData to HandleData"
These tools are your primary interface to C++ code understanding. Use them liberally and often. They are fast, accurate, and understand C++ semantics that text search cannot capture.
330
+
These tools are your primary interface to C++ code understanding. Use them liberally and often. They are fast, accurate, and understand C++ semantics that text-based search tools cannot capture.
372
331
373
332
**Your success metric**: Did I use the right C++ tool for every symbol-related task?
0 commit comments