-
Notifications
You must be signed in to change notification settings - Fork 10
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
Don't write errors to the file #5
Comments
Hi, thanks for taking the interest in my plugin. I'll have a look into a way to get the error output in a nicer format. |
The format is fine, just make sure not to write the error output into the current buffer. |
+1, this lost me some work unfortunately. If you have a syntax error and run :Yapf then the buffer is replaces with the trace with no way of returning to file content. My current workaround is to always save the file before running :Yapf but that isn't ideal. |
Can you not get the file contents back with u i.e. undo? That has always been OK I'm not saying this is not a problem with the plugin though, but your work may be recoverable. |
I've just updated the code to paste the exception in a new window rather than in the current buffer. It's not particularly graceful but it should suffice, until I get time to work on a nicer system |
Thanks a lot! 👍 :) |
Going to close this issue, hopefully the UX is a bit nicer now. |
My .vimrc has:
When yapf returns an error, my file is overwritten with the error. Can I reopen this bug? |
hi , i lost my file , because of code contain an error , i want to reopen this bug , the error msg can write same dir, i can fix error and look the error msg , thx |
@mindriot101 |
@melissachang your During my testing, when using the Why is it possible for you to lose code whereas it is not possible for me? |
This is my config file
When I type something wrong code in FILE.py and then save it, err msg overwrite my code. |
I haven't tried undoing. Perhaps document at https://github.com/mindriot101/vim-yapf how we're supposed to undo and get rid of the error message? |
I just ran into this again. The problem is, I don't notice the error and save the file (":w"). Then, I reopen the file and only see the error. Is there a way to get the original file back? I think it would be more user-friendly if instead of writing to the file, write the error to some file in the local filesystem. And don't change the vim buffer. |
Actually, with ":w" I have a chance to ":undo". The problem is "ZZ". The error is saved to the file and I never even see it. Then I have no way to recover my code. I lose all my changes that I haven't git commited. |
I've started a new PR with an updated README (#14). What else would you like to see? |
Sorry all for my lack of responses. I do not use this plugin myself and am therefore lacking in entheusiasm and time for it's maintenance. @melissachang I have given you commit access to the repository so you can contribute your suggestions, and maybe encourage PRs from other affected users. |
Hi, this happens to me as well. Did some user here find a solution for it in your vimrc? |
My workaround was to set up auto-backup: https://gist.github.com/nepsilon/003dd7cfefc20ce1e894db9c94749755 |
For the sake of Python I'd honestly just recommend switching to an IDE such as PyCharm or VS Code which has all of this built in without the flakiness. |
@melissachang setting |
YAPF doesn't like syntax errors and complains loudly about them. If there is a syntax error (and I execute Yapf), there current buffer gets replaced by a traceback.
I'd be nice if this plugin opens a new buffer (with the error) instead and leaves the original file unchanged. This is especially useful when using
autocmd BufWritePre
because it will not destroy my file. I'd like to useautocmd BufWritePre
so that my code is formatted every time I save the file. You could do that by checking the exit code. If it fails, the exit code will be '1'.The text was updated successfully, but these errors were encountered: