-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Deletes code if previous line has trailing spaces/tabs #101
Comments
This only happens if you have |
@melusc thank you for the detailed bug report. Unfortunately I couldn't repro this behavior, even in the linked repro and tested after toggling all the final new line options and trying to make changes and apply fixes very quickly. question 1 - what command do you use to format? Do you use "xo: fix all fixable problems" or do you use "format document" with xo enabled as the default formatter? I added a debounce to the linting in 3.3+ which helps performance, but may be causing some random regressions. I am going to be releasing another update today which makes that configurable. Perhaps turning that off will fix this for you (and this may be a broader windows problem). In the meantime, let me know if you can narrow it down any further! |
If I use "xo: fix all fixable problems" or "format document" it works perfectly, the issue occurs when I save, because I have format on save enabled and xo is the default formatter. That means that it must be running "trim trailing whitespace" and xo at the same time which must be causing issues. I also noticed that I copied the wrong setting-name in my previous comment, the conflict only occurs with "files.trimTrailingWhitespace" enabled. |
I tried removing all the settings that didn't change this behaviour and I ended up with {
"[javascript]": {
"editor.defaultFormatter": "samverschueren.linter-xo"
},
"editor.formatOnSave": true,
"xo.format.enable": true,
"files.trimTrailingWhitespace": true
} |
Thank you - I can reproduce this now. And confirmed it is indeed the debounce that causes this - although I am not quite sure why. It may be a VSCode bug for this race condition to be possible. I am going to be releasing a new version later today with the debounce off by default and configurable for large file performance and this will solve this. I will let you know when I do. |
@melusc - I just published 3.4.0 which defaults the debounce to 0 and fixes this issue. I recommend in the docs that you don't use these options together anymore. I'm going to leave this open as there may still be an issue on our side that can resolve this even with debounce turned on. Thanks! |
If you have something like this (note the trailing tabs on the first line):
and you format it using the extension it removes the trailing tabs and cuts off a bit of the next line. The result is something like this:
If you use
xo
from the cli it doesn't cut off anything, and if you use[email protected]
it doesn't either.I tried
v3.3.1
andv3.3.2
and both behaved like this.v3.3.0
crashes for me because I use Windows but I'd guess the bug snuck in there.I have created a repo with a minimal reproducible example: https://github.com/melusc/vscode-xo-indent-bug.
The text was updated successfully, but these errors were encountered: