Wrong behaviour with `insert_final_newline = true` and `"files.autoSave": "afterDelay"`
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
| Visual Studio Code | editorconfig-vscode | |
|---|---|---|
| Version | 1.63.2 |
v0.16.4 |
Root .editorconfig File
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Matches multiple files with brace expansion notation
[*.{js,ts,tsx}]
charset = utf-8
indent_style = space
indent_size = 4
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
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" |
"afterDelay" |
"___" |
files.insertFinalNewline |
false |
_____ |
_____ |
files.trimTrailingWhitespace |
false |
_____ |
_____ |
File opened
./file.ts
Expected behavior
When typing on last line in file and when (on auto save) added new insert_final_newline = true text cursor will stay where I stop typing.
Actual behavior
When typing something on last line of file and stop typing after auto save (after delay) will be added new empty line (due config insert_final_newline = true) and text cursor will be moved on that new empty line so need manually back to previous line to continue typing.
I also have this issue - It is quite annoying
+1
In fact this behaviour is not consistent with trim_trailing_whitespace=true + afterDelay. In that case the trailing whitespaces are removed only when forcing to save the file
I also have this issue. I found out vscode used to have it also and they fixed, hopefully won't be hard for editorconfig-vscode to replicate the fix.
This is a major annoying issue for years. Also reported on StackOverflow (turn feature off, problem solved! LOL).
Does the related fix in VSCode inspire someone to work on this issue?
File > Preferences > Settings > Auto Save
changing the 'auto save' setting to 'onFocusChange' You can work normally now