question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

trim_trailing_whitespace = false not working

See original GitHub issue
  • 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.

Delete the following condition if it doesn’t apply to your case:

If the extension is not picking up the expected configuration for a file:

  • I tried npm install editorconfig -g and ran editorconfig [file-in-question] and the configuration was what I expected. If not, please file on the editorconfig-core-js issue tracker.

Issue

Visual Studio Code editorconfig-vscode
Version 1.12.2 0.9.3

Root .editorconfig File

# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = 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 2 _
editor.trimAutoWhitespace true ____ ____
files.autoSave "off" "___" "___"
files.insertFinalNewline false true _____
files.trimTrailingWhitespace false true _____

File opened

./README.md

Expected behavior

trim_trailing_whitespace = false

Actual behavior

trim_trailing_whitespace = true

Additional comments or steps to reproduce

When I add 2 spaces to the end of a line to create a markdown line break and then save the file, the trailing spaces are removed. OS: Ubuntu 17.04

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:42
  • Comments:38 (13 by maintainers)

github_iconTop GitHub Comments

17reactions
S2-commented, Jul 17, 2017

i like my editor to trim whitespace. the only problem i have is with markdown files, where whitespace at the end is used for a newline. to workaround the problem i added this in vscode settings.json

    "files.trimTrailingWhitespace": true,
    "[markdown]": {
        "files.trimTrailingWhitespace": false
    }
7reactions
jednanocommented, Jun 7, 2018

I 100% agree, but the tests don’t cover this scenario, so it’s not exactly a supported feature. The {} braces are for multiple matches, so there’s really no reason to use them unless you’re trying to target multiple files or extensions like:

[{*.md,*.yml}]

☝️ that works. You know what also works?

[{*.md,}]

So you can either add this scenario to the tests or just use [{*.md,}] or [*.md] for now. Up to you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

VisualStudio Code trimTrailingWhitespace set to false is still ...
Apparently the files.trimTrailingWhitespace: false is not doing anything at all as it continues to trim whitespace on the file(s) on save. These ...
Read more >
editorconfig trim_trailing_whitespace only applies at end of file
The problem described here is simple: VS does not support .editorconfig file correctly. I do not know how the other issue could be...
Read more >
editorconfig-checker
Compared to other linting tools this tool is language agnostic and works for every language and ... if you use the wrong repository...
Read more >
.editorconfig `trim_trailing_whitespace` is ignored for ...
Relates to 4 issues (0 unresolved) ... IDEA-199518 Support trim_trailing_whitespace = false. 5. Is duplicated by 3 issues (0 unresolved).
Read more >
User and Workspace Settings - vscode-docs
trimTrailingWhitespace ": false, //-------- File Explorer configuration -------- // Maximum number of working files to show before scrollbars appear.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found