Skip to content

Commit aded76e

Browse files
Copilotheaths
andauthored
Add guidance for searching multi-line function call chains in Copilot instructions (#3138)
- [x] Review current copilot-instructions.md file structure - [x] Add guidance section about searching for function call chains - [x] Provide examples of multi-line Rust method chaining patterns - [x] Suggest using ripgrep with multi-line search or AST-based tools - [x] Condense guidance to reduce token count per feedback - [x] Add rustfmt to cspell.json word list ## Summary Updated the Copilot instructions with concise guidance about searching for multi-line function call chains in Rust code, and added "rustfmt" to the cspell.json dictionary. ### Changes: - Removed the separate "Searching for Code Patterns" section to reduce token count - Condensed all guidance into a single, concise bullet point in the Code Generation section - Removed redundant information while keeping the essential message: - Awareness that rustfmt formats method chains across multiple lines - Suggestion to use multi-line search patterns (`rg` with `-U` flag) - Alternative approach: search for individual method names - Added "rustfmt" to `.vscode/cspell.json` word list in alphabetical order This addresses the issue while being much more token-efficient. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Update Copilot instructions to search for call chains across multiple lines</issue_title> > <issue_description>I've noticed lately that Copilot often greps for function call chains like `obj.foo().bar()` when, in fact, rustfmt might've reformatted it across multiple lines like, > > ```rust > obj > .foo() > .bar(); > ``` > > Update the copilot-instructions.md to take this into account whenever it's grep'ing for function call chains.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes #3137 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start the survey. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: heaths <[email protected]>
1 parent 28cf840 commit aded76e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Use these instructions for test generation as well.
3939
- If you have trouble generating safe, efficient, maintainable, and lint-free code, insert a `TODO` comment describing what should happen.
4040
- All imported types, constants, functions, modules, and macros should be imported explicitly. Never import `*`.
4141
- Do not modify generated code, found in `generated` subdirectories. These files are generated by external tools and should not be edited manually.
42+
- When searching for function call chains in Rust code, be aware that rustfmt often formats method chains across multiple lines like `obj\n .foo()\n .bar()`. Use multi-line search patterns (e.g., `rg` with `-U` flag) or search for individual method names rather than complete call chains.
4243

4344
## Test Generation
4445

.vscode/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"rsplit",
7575
"rustfmt",
7676
"runtimes",
77+
"rustfmt",
7778
"rustup",
7879
"schannel",
7980
"seekable",

0 commit comments

Comments
 (0)