-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remote editing wipes out .go files with go_fmt_autosave enabled. #632
Comments
Didn't think about netrw with that commit! Looks like this can be hacked around by writing to |
That's an interesting issue :) @guns are you're working on it? If not let me know please. |
@fatih: Yes. I have found a couple of options, but I'm afraid I won't have time to write a solid patch until tomorrow. |
@guns no worries! Take your time. I just wanted to be sure if you're working on it :) Thanks on tackling this problem 👍 |
Just in case it's helpful for the patch, I also ran into revert/wipe symptoms in local file scenarios. My setup
ScenariosThese appear 100% reproducible for me in the cited 54946ea (but not in the prior commit) and current head (4de4eeb). New fileOpen a new file and add some code. A save ( Existing fileOpen an existing file that only contains "hi" and add some code. Caveats
|
Has there been any progress with this bug? I'm happy to test any experimental changes. Thanks. |
@mk23 not yet on my side as I was clearing my backlog. Just arrived at this issue. @guns do you have any kind of patch (even though it's not finished) ? If not I want to look at this problem. It's really frustrating that Vim makes it so hard to rewrite/update the content of a buffer. Every single step we make to improve the situation makes something else worse. |
I've run into this multiple times with local editing. After losing the file content and all vim undo information to this, I was lucky to be able to dig into my undo folder manually to recover the content from the last saved file. This is scary. Can I request to prioritize this data loss issue over any features or less important issues, please? |
Forgot about this. Like I mentioned before, writing to I will try to find the time today for this patch, but if I haven't posted a PR by the end of the day, I assure anyone reading that this is a relatively easy fix. |
Okay, having just spent a few minutes with this problem, I remember now why I never sent a PR. We AFAICT there are two solutions to the issue of netrw buffers:
I'm in favor of option 1 and would be happy to submit a patch for it. |
Just to be clear, I have this problem with local buffers and PS: It's possible that |
Bisecting revealed this commit to be the culprit: 54946ea
I use vim as my IDE and often use netrw(scp) for editing files on remote servers. I recently updated vim-go bundle and now every time I write the buffer out (ZZ or :w) the resulting file on the remote is completely wiped out. This only happens with auto gofmt is enabled.
Repro
Prerequisites
g:go_fmt_autosave = 1
Steps
vim scp://localhost/foo.go
package main
Observed
Expected
The text was updated successfully, but these errors were encountered: