I DON'T want trailing withe spaces removed on save. Follow
I have try everything I don't want trailing withe spaces removed on save.
I tried on General > other Strip railing spaces on save > none, on Code >keep white spaces.
none of them work. Every-time I save a file it removes the white spaces at the end of a line.
is this a Bug? any one?
Please sign in to leave a comment.
I have no idea what was written there (in no longer working link).
In any case: Settings/Preferences | Editor | General | Strip trailing space on Save -- adjust to whatever your needs are
NOTE: If you have .editorconfig file in your project, such option can also be controlled via that file. This file can provide more granular control over what files are affected by those settings.
Settings from .editorconfig file will OVERWRITE IDE settings (the whole nature of such files), so if you have such files in your project and such instruction there, you will have to either disable the EditorConfig for this project or disable plugin completely (if you do not care about it at all).
Thank you for the provided information!
So first of all, the project has no files, so I can't see how you reproduced the problem there. Moreover, in your settings I see that the option "Strip trailing spaces on Save" is set to All.
So please collect the information more attentively:
1) the project with at least one file where you reproduced the issue.
2) the correct settings
3) a screenshot of Editor | General | Other
4) a screenshot of the whole page of Editor | Code Style
5) idea.log after reproducing the problem (Help > Show log in...)
Do you have .editorconfig in your project? What IDE version do you use?
Sorry, I didn't get if you have .editorconfig file in your project or just EditorConfig plugin?
Is the option "Enable EditorConfig support" enabled in Settings/Preferences | Editor | Code Style? Does the problem persist if you disable it?
Hey! I'm sorry for resurrecting a 2 year old thread, but the link provided by Juniad is not working anymore. Can anyone post the solution directly in this thread or smth please?
Just chipping in here to say that I had this problem too. Make sure you check the .editorconfig file (probably at your project root).
Look for the line
There may be more than one as different sections can have the same rule for different types of files. If you never want to strip trailing whitespace from any file make sure you find all instances of this rule and set it to false
I don't have it.... is it a plugin? My IDE version is 2017.14
Sorry I do have it :/
It's a configuration file with code style settings. Is there anything about space trimming?
if I keep the cursor on the line it will keep the trailing white spaces. But if I move the cursor to another line it will delete the spaces on save
I don't have "EditorConfig support" option under Settings/Preferences | Editor | Code Style :/
1) If you don't have such option, it means that EditorConfig plugin is disabled.
2) Does the problem persist in a brand new project?
Please provide a sample project where the issue can be reproduced as well as your IDE's settings (File | Export Settings). You can upload these files to https://uploads.services.jetbrains.com/. Once uploaded, please let me know their names.
Still happens in a new project.
Files uploaded, the name of files are test and settings
Thanks, Junaid. This works for me.
In editorconfig, the setting in question is trim_trailing_whitespace. Even if it's not present at all, IntelliJ seems to assume a default value of true and trims the lines in the complete file.
>Even if it's not present at all, IntelliJ seems to assume a default value of true
if it's not there, IDEA doesn't assume anything, it uses Strip trailing space on Save option
I haven't checked in IDEA but in Rider 2019.3.4, if the trim_trailing_whitespace option is not present, it strips always all lines of a modified file even if Strip trailing space on Save is set to none.
Whatever I do off the things mentioned above, AndroidStudio always removes my empty lines on save!
This is very annoying!
PHPSTORM always trimming white spaces at end of line it's very annoying when double spaces of markdown are "break line"
my .editorconfig file is:
When does it happen - on re-formatting, on saving, or?
Later I'll try if it happen during reformatting
Do you have any on-save actions configured (run Prettier/ESlint on Save, files watchers, etc.)?
during reformatting spaces stay in place, eslint is disabled, prettier not installed, any other actions on save not found
Since the IDEA-105040 fix trailing spaces are never stripped in .md files on Save regardless of settings... So it must be some other tool that modifies your files
what other info I can send to You, or how can i check what is triggered during saving ?
No idea, sorry... It's not necessary a tool that is started from the IDE, can be some external file watcher
Can you reproduce the issue in a new project, BTW?
I tried with a brand new project with no files in it, copied in the directory of the project an existing md file with trailing double spaces, opened it and saved it after adding a line with random text in the file : line endings ARE trimmed of trailing spaces.
Thank you Daniel Lampard.
This problem happens in WebStorm 2022.2.3.
Finally I found it's caused by the .editorconfig file come from the project.