-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Navigating the codebase like a developer: f12/symbolic navigation tools #2105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -74,6 +74,10 @@ export class DefaultAgentPrompt extends PromptElement<DefaultAgentPromptProps> { | |||||
| No need to ask permission before using a tool.<br /> | ||||||
| NEVER say the name of a tool to a user. For example, instead of saying that you'll use the {ToolName.CoreRunInTerminal} tool, say "I'll run the command in a terminal".<br /> | ||||||
| If you think running multiple tools can answer the user's question, prefer calling them in parallel whenever possible{tools[ToolName.Codebase] && <>, but do not call {ToolName.Codebase} in parallel.</>}<br /> | ||||||
| {tools[ToolName.DocumentSymbols] && <>When you already know which file matters, start with {ToolName.DocumentSymbols} to understand its structure. The tool caches results and paginates them—request additional symbols with "page" or adjust "pageSize", and set "reset": true to refresh from the beginning. | ||||||
| {tools[ToolName.Definitions] && <> Use {ToolName.Definitions} when you have a line and symbol name to jump directly to the relevant definition.</>} | ||||||
| {tools[ToolName.Implementations] && <> Use {ToolName.Implementations} to list concrete implementations or overrides for the symbol at that position.</>} | ||||||
| {tools[ToolName.References] && <> Use {ToolName.References} to gather usages from the same position.</>}<br /></>} | ||||||
| {tools[ToolName.ReadFile] && <>When using the {ToolName.ReadFile} tool, prefer reading a large section over calling the {ToolName.ReadFile} tool many times in sequence. You can also think of all the pieces you may be interested in and read them in parallel. Read large enough context to ensure you get what you need.<br /></>} | ||||||
| {tools[ToolName.Codebase] && <>If {ToolName.Codebase} returns the full contents of the text files in the workspace, you have all the workspace context.<br /></>} | ||||||
| {tools[ToolName.FindTextInFiles] && <>You can use the {ToolName.FindTextInFiles} to get an overview of a file by searching for a string within that one file, instead of using {ToolName.ReadFile} many times.<br /></>} | ||||||
|
|
@@ -228,6 +232,10 @@ export class AlternateGPTPrompt extends PromptElement<DefaultAgentPromptProps> { | |||||
| No need to ask permission before using a tool.<br /> | ||||||
| NEVER say the name of a tool to a user. For example, instead of saying that you'll use the {ToolName.CoreRunInTerminal} tool, say "I'll run the command in a terminal".<br /> | ||||||
| If you think running multiple tools can answer the user's question, prefer calling them in parallel whenever possible{tools[ToolName.Codebase] && <>, but do not call {ToolName.Codebase} in parallel.</>}<br /> | ||||||
| {tools[ToolName.DocumentSymbols] && <>When you already know which file matters, start with {ToolName.DocumentSymbols} to understand its structure. The tool caches results and paginates them—request additional symbols with "page" or adjust "pageSize", and set "reset": true to refresh from the beginning.<br /></>} | ||||||
| {tools[ToolName.Definitions] && <> Use {ToolName.Definitions} when you have a line and symbol name to jump directly to the relevant definition, like a developer would have used f12.<br /></>} | ||||||
| {tools[ToolName.Implementations] && <> Use {ToolName.Implementations} to list concrete implementations or overrides for the symbol at that position.<br /></>} | ||||||
| {tools[ToolName.References] && <> Use {ToolName.References} to gather usages for a symbol at that position.<br /></>} | ||||||
| {tools[ToolName.ReadFile] && <>When using the {ToolName.ReadFile} tool, prefer reading a large section over calling the {ToolName.ReadFile} tool many times in sequence. You can also think of all the pieces you may be interested in and read them in parallel. Read large enough context to ensure you get what you need.<br /></>} | ||||||
| {tools[ToolName.Codebase] && <>If {ToolName.Codebase} returns the full contents of the text files in the workspace, you have all the workspace context.<br /></>} | ||||||
| {tools[ToolName.FindTextInFiles] && <>You can use the {ToolName.FindTextInFiles} to get an overview of a file by searching for a string within that one file, instead of using {ToolName.ReadFile} many times.<br /></>} | ||||||
|
|
@@ -331,6 +339,7 @@ export class McpToolInstructions extends PromptElement<{ tools: readonly Languag | |||||
| */ | ||||||
| export class CodesearchModeInstructions extends PromptElement<DefaultAgentPromptProps> { | ||||||
| render(state: void, sizing: PromptSizing) { | ||||||
| const tools = detectToolCapabilities(this.props.availableTools); | ||||||
|
||||||
| const tools = detectToolCapabilities(this.props.availableTools); |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line break between sentences. According to the TSX coding guidelines, <br /> should be used for line breaks in prompt TSX files. The text "Always prefer symbolic navigation when applicable. Use {ToolName.DocumentSymbols}" should have a <br /> after "when applicable." to properly separate the sentences.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line break. According to the TSX coding guidelines, <br /> should be used for line breaks. Add <br /> at the end of this line to properly separate it from the next instruction.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing period at the end of the sentence. The sentence ending with "their usages" should have a period before the next sentence starts.
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages<br /> | |
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages.<br /> |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line break. According to the TSX coding guidelines, <br /> should be used for line breaks. Add <br /> at the end of this line to properly separate it from the next instruction.
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple spelling and punctuation errors:
- "codeobase" should be "codebase"
- The sentence "very useful when modifying..." should start with a capital letter
- Missing period at the end of the sentence
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codebase. Very useful when modifying public function signatures or data structures.<br /> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,6 +54,11 @@ export class CodebaseAgentPrompt extends PromptElement<GenericBasePromptElementP | |||||||||||||||||||||||||||||
| Remember that you can call multiple tools in one response.<br /> | ||||||||||||||||||||||||||||||
| If you think running multiple tools can answer the user's question, prefer calling them in parallel whenever possible, but do not call `{ToolName.Codebase}` in parallel.<br /> | ||||||||||||||||||||||||||||||
| Use `{ToolName.Codebase}` to search for high level concepts or descriptions of functionality in the user's question.{!isCodesearchFast && ` Note that '${ToolName.Codebase}' is slow, so you should only run it if you are confident its results will be relevant.`}<br /> | ||||||||||||||||||||||||||||||
| Always prefer symbolic navigation when applicable. | ||||||||||||||||||||||||||||||
| Use {ToolName.DocumentSymbols} After you have a likely file, call {ToolName.DocumentSymbols} to review its structure, and get accurate symbols and their line numbers for further navigation. Page through results with the "page" and "pageSize" options, or set "reset": true to rebuild the cache before paging. <br /> | ||||||||||||||||||||||||||||||
|
Comment on lines
+57
to
+58
|
||||||||||||||||||||||||||||||
| Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | ||||||||||||||||||||||||||||||
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | ||||||||||||||||||||||||||||||
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | ||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+61
|
||||||||||||||||||||||||||||||
| Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence starts with lowercase "you" after a period. It should be capitalized: "You must use the line number..."
| Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence "very useful when modifying..." should start with a capital letter: "Very useful when modifying..."
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> | |
| Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation. According to the coding guidelines, tabs should be used for indentation. This line uses tabs but is misaligned with the surrounding code. The opening brace should align with the lines above it at lines 224 and 267.