skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.84k stars 109 forks source link

add AsyncReset #252

Closed yehuohan closed 1 year ago

yehuohan commented 2 years ago

Awesome plugin! We all dislike to run terrible code, but there will still be some case like #204 and we have to restart (neo)vim instance. So I think it's great to have an AsyncReset command to reset internal state forcely and ignore the crashed process directly.

@skywind3000 Are you willing to merge this PR to provide a reset command, which may have some corner negetive effect though (e.g. The crashed progress is allocating memory crazily).

Or could you give some comments on the function asyncrun#reset below, which just reset two script variable forcely?

function! asyncrun#reset()
    let s:async_state = 0
    if exists('s:async_job')
        let s:async_job = 0
    endif
endfunc
skywind3000 commented 1 year ago

Thanks, this patch couldn't fully reset the internal status.

So I implemented a new one: https://github.com/skywind3000/asyncrun.vim/commit/a7a83c1ecdcd54636247454694ddd5d9086e3b68

Thanks anyway

yehuohan commented 1 year ago

Thanks, this patch couldn't fully reset the internal status.

So I implemented a new one: a7a83c1

Thanks anyway

It seemed there are some issue with my testing with the https://github.com/skywind3000/asyncrun.vim/commit/a7a83c1ecdcd54636247454694ddd5d9086e3b68.

I tested with the code below:

int main(int argc, char *argv[]) {
    return -1;
}

But when AsyncReset was executed, a issue raised:

图片

skywind3000 commented 1 year ago

@yehuohan please try: https://github.com/skywind3000/asyncrun.vim/commit/2483bbd0f55bd33cbcc021fafc187c1f6a0e7354

yehuohan commented 1 year ago

@yehuohan please try: 2483bbd

Everything works perfectly. Thanks.