`insert_final_newline = false` not working
Please fill-in this template.
- [x] I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
- [x] I tried running
code --disable-extensionsand the issue did NOT present itself.
Issue
On Windows 11
| Visual Studio Code | editorconfig-vscode | |
|---|---|---|
| Version | 1.76.1 |
0.16.4 |
Root .editorconfig File
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
Are there any other relevant .editorconfig files in your project? No
| Visual Studio Code Setting | Default | User | Workspace |
|---|---|---|---|
editor.insertSpaces |
true |
____ |
____ |
editor.tabSize |
4 |
_ |
_ |
editor.trimAutoWhitespace |
true |
____ |
____ |
files.autoSave |
"off" |
"___" |
"___" |
files.insertFinalNewline |
false |
_____ |
_____ |
files.trimTrailingWhitespace |
false |
_____ |
_____ |
File opened
Any file
Expected behavior
Without adding final new line automatically when insert_final_newline = false
Actual behavior
Always adding final new line automatically
Same here, very annoying.
As a workaround, the user can enable the global VSCode Trim Final Newlines option.
However, that has poor integration with EditorConfig. And, if you happen to be working on text fixtures, then you cannot adjust this setting on a per directory basis. You're stuck with either over-sanitized test fixture files, or else under-sanitized source code files.
@mcandre
While you can't adjust the setting on per-directory basis, you can on per-language instead.
So something like this in the settings.json:
{
"[javascript]": {
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
},
"[markdown]": {
"files.insertFinalNewline": false
"files.trimFinalNewlines": false
},
}
Per-directory can be achieved too but only for vscode, by creating ./vscode/settings.json in the directory with the settings you need.
I have it too: insert_final_newline = false is not respected, if the user setting of VS Code has this set to true.
Please fix this or at least mention in the readme too.
I am not a fan of configuring text editors. I float between several. I specifically use EditorConfig to avoid this problem. If I wanted to perform the configuration with VSCode, then I wouldn't be using EditorConfig.
Same problem. Please fix it 😭😭