Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 7, 2025

  • Review current copilot-instructions.md file structure
  • Add guidance section about searching for function call chains
  • Provide examples of multi-line Rust method chaining patterns
  • Suggest using ripgrep with multi-line search or AST-based tools
  • Condense guidance to reduce token count per feedback
  • 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.

Original prompt

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,

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)

Fixes #3137

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Update Copilot instructions for multi-line function calls Add guidance for searching multi-line function call chains in Copilot instructions Oct 7, 2025
@Copilot Copilot AI requested a review from heaths October 7, 2025 20:34
Copilot finished work on behalf of heaths October 7, 2025 20:34
@Copilot Copilot AI requested a review from heaths October 7, 2025 21:07
Copilot finished work on behalf of heaths October 7, 2025 21:07
Copy link
Member

@heaths heaths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a try. I thought the individual instructions from before were better.

@heaths
Copy link
Member

heaths commented Oct 7, 2025

@copilot add "rustfmt" to .vscode/cspell.json's word list and make sure all checks pass.

@heaths heaths marked this pull request as ready for review October 7, 2025 21:50
@Copilot Copilot AI review requested due to automatic review settings October 7, 2025 21:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds guidance to the Copilot instructions to help with searching multi-line function call chains in Rust code. The issue addressed is that Copilot was searching for method chains as single-line patterns when rustfmt typically formats them across multiple lines.

  • Added a bullet point to remind about rustfmt's multi-line formatting of method chains
  • Suggests using multi-line search patterns with rg -U flag or searching for individual method names
  • Provides practical guidance to improve code search accuracy

Copy link
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot add "rustfmt" to .vscode/cspell.json's word list and make sure all checks pass.

Added "rustfmt" to .vscode/cspell.json word list in alphabetical order. JSON validation passed. (b97f8c0)

@Copilot Copilot AI requested a review from heaths October 7, 2025 21:54
Copilot finished work on behalf of heaths October 7, 2025 21:54
@heaths
Copy link
Member

heaths commented Oct 9, 2025

/check-enforcer evaluate

@heaths heaths enabled auto-merge (squash) October 9, 2025 21:48
@heaths heaths merged commit aded76e into main Oct 9, 2025
19 checks passed
@heaths heaths deleted the copilot/update-copilot-instructions-multi-line-calls branch October 9, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Copilot instructions to search for call chains across multiple lines

4 participants