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
9
+
1.**`GetSymbolInfo_CppTools`** - Find symbol definitions and get type information
10
10
2.**`GetSymbolReferences_CppTools`** - Find ALL references to a symbol
11
11
3.**`GetSymbolCallHierarchy_CppTools`** - Analyze function call relationships
12
12
13
13
---
14
14
15
15
## Mandatory Tool Usage Rules
16
16
17
-
### Rule 1: ALWAYS Use GetSymbolReferences_CppTools for Symbol Usages
17
+
### Rule 1: Prefer GetSymbolReferences_CppTools as the default for locating C/C++ Symbol Usages
18
18
19
-
**NEVER** rely on manual code inspection, `vscode_listCodeUsages`, `grep_search`, or `read_file`to find where a symbol is used.
19
+
**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.)
22
+
-Any task involving "find all references/usages/uses"
23
23
- Changing function signatures
24
24
- Refactoring code
25
25
- Understanding symbol impact
26
-
- Finding all call sites
27
26
- Identifying usage patterns
28
-
- Any task involving "find all uses/usages/references/calls"
29
27
30
28
**Why**: `GetSymbolReferences_CppTools` uses C++ IntelliSense and understands:
31
-
-Overloaded functions
32
-
-Template instantiations
29
+
-Differentiating between overloaded functions
30
+
-Differentiating between template instantiations
33
31
- Qualified vs unqualified names
34
32
- Member function calls
35
33
- Inherited member usage
36
-
- Preprocessor-conditional code
34
+
- Preprocessor conditionals for the active configuration
37
35
38
36
Text search tools will miss these or produce false positives.
39
37
@@ -54,9 +52,7 @@ Before modifying any function signature, **ALWAYS** call `GetSymbolCallHierarchy
54
52
55
53
Before working with unfamiliar code, **ALWAYS** call `GetSymbolInfo_CppTools` to:
56
54
- Find where a symbol is defined
57
-
- Understand class/struct memory layout
58
55
- Get type information
59
-
- Locate declarations
60
56
61
57
**NEVER** assume you know what a symbol is without checking.
62
58
@@ -91,27 +87,12 @@ Before working with unfamiliar code, **ALWAYS** call `GetSymbolInfo_CppTools` to
91
87
Start with minimal information and add more only if needed:
92
88
1.**First attempt**: Symbol name only
93
89
2.**If ambiguous**: Symbol name + file path
94
-
3.**If still ambiguous**: Symbol name + file path + line number (after using `read_file`)
90
+
3.**If still ambiguous**: Symbol name + file path + line number (after using `read_file` workflow mentioned above)
95
91
96
92
---
97
93
98
94
## Common Workflows
99
95
100
-
### Renaming a Symbol
101
-
102
-
```
103
-
CORRECT workflow:
104
-
1. Call GetSymbolReferences_CppTools with symbol name (and file path if available)
105
-
2. Review ALL references returned
106
-
3. Update symbol at definition location
107
-
4. Update symbol at ALL reference locations
108
-
109
-
INCORRECT workflow:
110
-
❌ Using vscode_listCodeUsages or grep_search to find usages
111
-
❌ Manually inspecting a few files
112
-
❌ Assuming you know all the usages
113
-
```
114
-
115
96
### Changing a Function Signature
116
97
117
98
```
@@ -133,8 +114,8 @@ INCORRECT workflow:
133
114
```
134
115
CORRECT workflow:
135
116
1. Call GetSymbolInfo_CppTools on key types/functions to understand definitions
136
-
3. Call GetSymbolCallHierarchy_CppTools with callsFrom=true to understand what a function does
137
-
4. Call GetSymbolCallHierarchy_CppTools with callsFrom=false to understand where a function is used
117
+
2. Call GetSymbolCallHierarchy_CppTools with callsFrom=true to understand what a function does
118
+
3. Call GetSymbolCallHierarchy_CppTools with callsFrom=false to understand where a function is used
138
119
139
120
INCORRECT workflow:
140
121
❌ Reading code manually without tool assistance
@@ -219,15 +200,16 @@ This is NOT an error - it means:
219
200
### DO:
220
201
- ✅ Call `GetSymbolReferences_CppTools` for ANY symbol usage search
221
202
- ✅ Call `GetSymbolCallHierarchy_CppTools` before function signature changes
222
-
- ✅ Use `read_file` to find line numbers before specifying them
203
+
- ✅ Use `read_file` to find line numbers before specifying them### Rule 1: Prefer GetSymbolReferences_CppTools as the default for locating C/C++ Symbol Usages
204
+
- ✅ 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.
223
205
- ✅ Provide absolute file paths when available
224
206
- ✅ Follow error message instructions exactly
225
207
- ✅ Trust tool results over manual inspection
226
208
- ✅ Use minimal parameters first, add more if needed
227
209
- ✅ Remember line numbers are 1-based
228
210
229
211
### DO NOT:
230
-
- ❌ Use`vscode_listCodeUsages`, `grep_search`, or `read_file` to find symbol usages
212
+
- ❌ Rely on text-based search tools such as`vscode_listCodeUsages`, `grep_search`, or `read_file` to find symbol usages
231
213
- ❌ Manually inspect code to find references
232
214
- ❌ Guess line numbers
233
215
- ❌ Assume symbol uniqueness without checking
@@ -241,24 +223,7 @@ This is NOT an error - it means:
241
223
242
224
## Examples of Correct Usage
243
225
244
-
### Example 1: User asks to rename a function
245
-
```
246
-
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.
309
+
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.
345
310
346
311
**Your success metric**: Did I use the right C++ tool for every symbol-related task?
0 commit comments