microsoft / microsoft/copilot-for-eclipse

Tools like replace_string_in_file introduce wrong line endings during edit

Open
#98 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
126
Forks
60
Avg merge
2d 6h
Merged PRs (30d)
5

Description

Feedback source

None

GitHub Copilot plugin version

0.15.0.202602060509_nightly

Eclipse IDE and version

2025-06 (4.36.0) Enterprise Java and Wev Developers

Platform

Microsoft Windows NT 10.0.22631.0 x64

Steps to reproduce
  1. Set Eclipse to use CRLF as line endings (Window → Preferences → General → Workspace → New text file line delimiter).
  2. Create an empty Java class "Example" by New->Class in Eclipse.
package de.ivu.example;

public class Example {
}
  1. Run Copilot in agent mode, add the empty class "Example.java" to the context.
  2. Prompt "Please create some example code in this class (just print something in a main method)." and accept the proposed change. Note that during editing the "replace_string_in_file" tool must be used.
  3. Check line endings of the newly created lines in the Java file in an editor or tool of your choice.
Logs (optional)

No response

Expected behavior

Expectation: consistent new lines in modified files - either use the line endings found in the file before modification or even better use the setting in Eclipse during line operations by tools.

package de.ivu.example;CRLF
CRLF
public class Example {CRLF
CRLF
    public static void main(String[] args) {CRLF
        System.out.println("Hello from Example!");CRLF
    }CRLF
CRLF
}CRLF
Actual behavior

Result: The lines 3-8 (see screenshot) generated by the tool (class definition, empty line, main method, println, closing bracket and an empty line) all end with LF only, all other lines previously written by me with the help of Eclipse are using CRLF as expected.

package de.ivu.example;CRLF
CRLF
public class Example {LF
LF
    public static void main(String[] args) {LF
        System.out.println("Hello from Example!");LF
    }LF
LF
}CRLF
Image
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in Eclipse on Windows with CRLF configured, using the replace_string_in_file tool against Example.java. Trace the tool's edit entry point and compare the line endings before and after modification. Done means newly inserted lines consistently use the file's existing or Eclipse-configured delimiter.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.