Skip to content

Normalize different EOL when agents edit/diff/patch file(s) #637

@MrXiaoM

Description

@MrXiaoM

Is your feature request related to a problem? Please describe.
When I am using gemini-3-flash-preview from some New-API-like routers. They usually encounter edit fail situation when they need to replace content. In the error details, the search content and best match content looks the same but only about 97% matches.

I copied error details and check is each line matches by search bar in vscode, they actually all matched. So I guess it is caused by different end-of-line.

For example, original content uses CRLF. The fool agents ignored end-of-line and submit a patch with LF end-of-line. So search content and best match tips just the same in display but with different end-of-line.

I never seen edit fails with other agents before. It seems only appear with gemini.

Describe the solution you'd like
We can just auto normalize different EOL. For example, check about what EOL first before edit, then replace all \r\n to \n. After edit, replace all \n back to the original EOL.

I implemented the experimental feature here but I have done it with 100% AI. Although it works well in recent edits, but I would not create a Pull Request because I am so poor in vscode extensions.

Describe alternatives you've considered
none.

Additional context

  • System: Windows 11
  • Editor: VS Code
  • Model: gemini-3-flash-preview (OpenAI Compatible provider) from a private router site.

Using default prompts without changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions