Skip to content

Autoformat removes new-line before EOF #1487

Closed
@kaysievers

Description

@kaysievers

Describe the problem

The autoformat feature removes the last line's new-line, disturbs all sorts of diff / git tools.

Quoting the C++ standard: A source file that is not empty and that does not end in a new-line character, or that ends in a splice, shall be processed as if an additional new-line character were appended to the file.

Could this be changed to leave the new-line in place, or maybe even add one if it is missing?

Thanks!

Example:
Screen Shot 2022-09-23 at 11 51 35

To reproduce

Press CMD-T and save. Look at the last character in the sketch file.

Expected behavior

Leave the new-line before EOF in place.

Arduino IDE version

2.0-nightly-202209

Operating system

macOS

Operating system version

12.6

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions