vscode-trailingspaces icon indicating copy to clipboard operation
vscode-trailingspaces copied to clipboard

trimOnSave doesn't work #21 reopened

Open osumko opened this issue 3 years ago • 3 comments
trafficstars

#21 It kind of work but not completely.

It did trim only modified lines, but once I revert changes back to original state by hitting cmd+z or "Revert change" from popup, it still conciders those line changes as mine and I'm no longer able to save file without triming that line. The only way to skip trimming is to run git reset on file.

osumko avatar Jul 11 '22 09:07 osumko

Can you elaborate more with some examples of your scenario?

Based on what I understand till now, this issue not really related to #21, which was more about deleteModifiedLinesOnly not identifying some lines as modified.

I think the behavior you see is expected. deleteModifiedLinesOnly identifies the lines you have changed since the last save and trims only those lines. Using Ctrl + Z to revert changes is also one way of modifying files. So I would expect it to trim the lines reverted manually in the editor.

shardulm94 avatar Jul 12 '22 14:07 shardulm94

I undertand. Maybe my explanation isn't ideal, but anyway, it still triggers trim even though I undo my changes. So I would commit changes that I didn't intend to commit just because I ever touch that line.

osumko avatar Jul 12 '22 15:07 osumko

I have the next trailing-spaces config:

{
    "trailing-spaces.highlightCurrentLine": false,
    "trailing-spaces.trimOnSave": true,
    "trailing-spaces.deleteModifiedLinesOnly": true
}

I'm noticed that sometimes spaces survive at the end of line. Do not know exactly why. Some way extension does not consider some modified lines to be modified.

ltWolfik avatar Apr 07 '23 17:04 ltWolfik