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

insert_final_newline = false not working #349

Open
2 tasks done
ccmywish opened this issue Mar 15, 2023 · 5 comments
Open
2 tasks done

insert_final_newline = false not working #349

ccmywish opened this issue Mar 15, 2023 · 5 comments

Comments

@ccmywish
Copy link

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

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

@RobertAKARobin
Copy link

Same here, very annoying.

@mcandre
Copy link

mcandre commented Apr 24, 2023

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.

@GabenGar
Copy link

GabenGar commented May 4, 2023

@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.

@serkonda7
Copy link

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.

@mcandre
Copy link

mcandre commented May 8, 2023

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.

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