Skip to content
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

Warn when running go#cmd#autowrite() without autowrite enabled #1754

Merged
merged 1 commit into from
Apr 8, 2018
Merged

Warn when running go#cmd#autowrite() without autowrite enabled #1754

merged 1 commit into from
Apr 8, 2018

Conversation

arp242
Copy link
Contributor

@arp242 arp242 commented Apr 4, 2018

The go#cmd#autowrite() will write buffers to disk for commands that
operate on files (rather than buffers). This is useful, but if you
don't have this option enabled you never get an error message.

This changed that to show a non-fatal warning. This is the same
behaviour as the :make command.

Right now this doesn't work very well because the various status
messages from the jobs push the error away, making it hard to see (I
don't get the expected "hit enter" prompt), so we need a better solution
for that first.

@arp242
Copy link
Contributor Author

arp242 commented Apr 7, 2018

I added a 1 second sleep to make the error message a bit more visible. It's a bit meh, but not sure how to do it better without completely revamping the way we echo messages.

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 7, 2018

1 second for each file that's modified could be excessive. Maybe do that after iterating if any buffers are modified?

@arp242
Copy link
Contributor Author

arp242 commented Apr 7, 2018

Ah yes, that is a bit silly.

I changed it to show the message once only, which is also what :make does. Showing the same message more than once doesn't really add any value.

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 8, 2018

Does the message disappear due to a redraw without the sleep? Assuming yes, lgtm.

@arp242
Copy link
Contributor Author

arp242 commented Apr 8, 2018

Does the message disappear due to a redraw without the sleep

Not due to redaw as such, but because echo from an async callback will just override the contents, instead of invoking the "hit ENTER" prompt like when you run echo twice.

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 8, 2018

Ship it.

The `go#cmd#autowrite()` will write buffers to disk for commands that
operate on files (rather than buffers). This is useful, but if you
*don't* have this option enabled you never get an error message.

This changed that to show a non-fatal warning. This is the same
behaviour as the `:make` command.

Right now this doesn't work very well because the various status
messages from the jobs push the error away, making it hard to see (I
don't get the expected "hit enter" prompt), so we need a better solution
for that first.
@arp242 arp242 merged commit 8379651 into fatih:master Apr 8, 2018
@arp242 arp242 deleted the warn-unsaved branch April 8, 2018 00:23
" often immediacy overwritten by the async messages (which also don't
" invoke the "hit ENTER" prompt).
call go#util#EchoWarning('[No write since last change]')
sleep 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will sleep block any other running async calls? Seems like a dangerous thing to add in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants