Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim Final Newlines integrates poorly with EditorConfig for Windows files #94562

Open
mcandre opened this issue Apr 6, 2020 · 5 comments
Open
Assignees
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Milestone

Comments

@mcandre
Copy link

mcandre commented Apr 6, 2020

Overall VSCode does a decent job integrating with EditorConfig. Including the Trim Final Newlines setting once enabled.

However, where final EOLs are disabled (such as for .AHK and other Windows-centric files), then Trim Final Newlines fails to delete final EOLs. How can we make sure that VSCode respects more EditorConfig configurations?

In particular:

  • Binary files should be ignored/preserved as-is.
  • .PATCH files should be ignored/preserved as-is.
  • Text files with contents consisting of exactly one EOL (CRLF, LF, or CR) should be ignored/preserved as-is.
  • .CS, .FS, .FSX, .VBS, .BAT, .COM, .PS1, .AHK, and other Windows-centric files should have zero trailing EOLs at the end of the buffer.
  • All other files should have exactly one (LF) EOL at the end of the buffer.

VSCode 1.43.2
Windows 10

@snebjorn
Copy link

I 2nd this. The "Files: Eol" settings should respect the .editorconfig setting

image

Auto (default) shouldn't just look at which OS is used. But first look at what EOL .editorconfig suggests for the file type and if none is configured it should work as today.

@rebornix rebornix added the feature-request Request for new features or functionality label Jun 25, 2020
@hepcat72
Copy link

I don't know if my issue is associated with this issue (as I have the macOS version), but I had 3 .tsv files, each ending in a single newline character (which I could copy and paste and confirm), yet editorconfig was complaining that the final line of each of these 3 files was missing a newline character (\n) (aka "linefeed"). I had to have my files (apparently) ending in 2 consecutive newline characters to silence the editorconfig errors. Again, I could copy and paste those two newlines, each showing as 2 empty numbered lines in the editor.

I closed VS code. Then later, when I examined the files on the command line, they all seemed to end in a single newline character, so I re-opened the project in VS Code, thinking it had inserted carriage returns, and to my surprise, it displayed a single newline at the end of each file. I checked each file for the presence of carriage returns (using a perl one-liner matching \r) and found none. I'm dumbfounded as to why it previously displayed 1 newline character at the end of these files when editorconfig complained there were none - and displayed 2 consecutive copyable newline characters that silenced the editorconfig error - and which my checks confirm constituted only 1.

Should I create a new issue for this or is this associated with this issue?

@rebornix rebornix assigned bpasero and unassigned rebornix Dec 5, 2023
@bpasero bpasero removed their assignment Dec 6, 2023
@bpasero bpasero removed the feature-request Request for new features or functionality label Dec 6, 2023
@bpasero bpasero removed this from the Backlog milestone Dec 6, 2023
@bpasero
Copy link
Member

bpasero commented Dec 6, 2023

Originally came in via contribution it seems: #33947

@hediet hediet added feature-request Request for new features or functionality editor-core Editor basic functionality labels Dec 7, 2023
@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone Dec 7, 2023
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@VSCodeTriageBot
Copy link
Collaborator

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

9 participants