Cursor adds newline to files with existing newlines

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Cursor’s file indexing process repeatedly adds trailing newlines to source files, even when files.insertFinalNewline is set to false and files.trimFinalNewlines is set to true. This creates phantom “modified” files in Git that the user never edited.

Steps to Reproduce

Open a multi-root workspace with multiple repositories
Commit all changes so git status shows clean working tree
Enable Cursor indexing (Codebase Indexing)
Wait for indexing to complete
Run git status - files will show as modified
Run git diff - only change is an added newline at end of file

Expected Behavior

Files should remain unmodified. The indexing process should be read-only.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.2.44 (Universal)
VSCode Version: 1.105.1
Commit: 20adc1003928b0f1b99305dbaf845656ff81f5d0
Date: 2025-12-24T21:41:47.598Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Opus 4.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

2 Likes

+1 so annoying

Hey, thanks for the report. This is a known issue the team is working on.

The bug affects files that were modified by Agent or indexing, and it adds trailing newlines when the IDE starts, ignoring files.insertFinalNewline and files.trimFinalNewlines.

Workaround (works for some users):

  1. Open the changed files in the Source Control panel
  2. Click “Keep” for each file
  3. Remove the extra blank line
  4. After restarting the IDE, the issue should stop for those files

Related threads with more info:

+1, work around didn’t work for me

1 Like

Hey @pauljulianheise, this issue should be fixed in version 2.3, which will be released soon. Once 2.3 is out, please update and check if the issue is gone.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.