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

Wrong behaviour with insert_final_newline = true and "files.autoSave": "afterDelay" #330

Open
2 tasks done
psnet opened this issue Jan 9, 2022 · 4 comments
Open
2 tasks done

Comments

@psnet
Copy link

psnet commented Jan 9, 2022

Please fill-in this template.

  • I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
  • I tried running code --disable-extensions and 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.

@cgaube
Copy link

cgaube commented Feb 23, 2022

I also have this issue - It is quite annoying

@tercebusuu
Copy link

+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

@LeonnardoVerol
Copy link

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.

@bittner
Copy link

bittner commented May 14, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants