-
Notifications
You must be signed in to change notification settings - Fork 386
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
Display warning if test file has unwritten changes #723
Comments
Let me have a think about this and get back to you |
@codeinabox any thoughts on this? |
Would this only apply to the test file when running |
In the general case, it's not feasible to check whether there are unsaved changes that will affect a test as there could be unsaved changes in other buffers, in another vim process, or in another editor. If this proposed change was accepted, then I'd suggest that we add a warning note in the docs on this point. For my specific use case, I tend to be tweaking the test file and forget to save it before running the test, so a simple check of the state of the test file would suffice. To make this more useful to others, I was thinking that a prompt would be useful, something like:
so the user can choose what to do in a particular situation. |
If this is a behaviour that will just apply to |
Running the test against the version in the buffer would be really nice. However, making this work reliably across all the various test runners might be quite awkward. For example, with pytest the following file name schemes don't work:
The name We may need to provide a default naming scheme, e.g. |
I'd like vim-test to display a warning if the test file I'm in has unsaved changes. I know that I can use the autowrite option, but running
:wall
here seems a bit aggressive for my liking. So I propose:let g:test#warn_if_unsaved_changes = 1
s:before_run()
which displays a warning to the user if the file isn't savedAs a possible extension, the message could wait for user input to either save the current file, save all files, run it anyway or abort.
I'm happy to give this a go, but wanted to get thoughts from the maintainers before doing so.
The text was updated successfully, but these errors were encountered: