Problem description and reproduction
If you have a .edtiorconfig like this:
root = true
[*]
trim_trailing_whitespace = false
insert_final_newline = true
Then create a file, let's say an example.txt in the directory of this .editorconfig file. If you now add only spaces to the inserted final newline, the file does not end with a newline anymore. However, VSCodium (or VSCode) does not insert a final newline on save after the line with only spaces. (If a line only ends with spaces, but has other content, it works without any problems.)
Is it a bug?
As this is kind of an edge case, you may ask if that is a bug or works as specified. For this take a look at the specification of insert_final_newline (version 0.17.2):
Set to true ensure file ends with a newline when saving and false to ensure it doesn’t. Editors must not insert newlines in empty files when saving those files, even if insert_final_newline = true.
This does not mention anything about handling lines without only spaces somehow special. Also in other parts of the specification I cannot find anything related to this edge case. Furthermore, I tested some other editors, namely Kate and KWrite from KDE, vim and PyCharm (with Plugin). They all insert a final newline after a line of only spaces.
Environment
- editorconfg extension: 0.18.2
- VSCodium:
- Version: 1.116.02821
- Electron: 39.8.7
- Chromium: 142.0.7444.265
- Node.js: 22.22.1
- V8: 14.2.231.22-electron.0
- OS: Linux x64 7.0.3-1-MANJARO
Problem description and reproduction
If you have a
.edtiorconfiglike this:Then create a file, let's say an
example.txtin the directory of this.editorconfigfile. If you now add only spaces to the inserted final newline, the file does not end with a newline anymore. However, VSCodium (or VSCode) does not insert a final newline on save after the line with only spaces. (If a line only ends with spaces, but has other content, it works without any problems.)Is it a bug?
As this is kind of an edge case, you may ask if that is a bug or works as specified. For this take a look at the specification of
insert_final_newline(version 0.17.2):This does not mention anything about handling lines without only spaces somehow special. Also in other parts of the specification I cannot find anything related to this edge case. Furthermore, I tested some other editors, namely Kate and KWrite from KDE, vim and PyCharm (with Plugin). They all insert a final newline after a line of only spaces.
Environment