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
Add support for NeomakeJobCancelled user event #2513
base: master
Are you sure you want to change the base?
Conversation
Thanks already. |
Makes sense. I'll omit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update.
Haven't looked at CI failures, but the current approach seems fine to me.
Please update, or let me know if I should do it.
I made the changes you requested.
I wasn't able to see anything related to my changes in the logs. It was hard for me to see what's going on as I'm not used to the output there. So, I really don't know what is causing the failure. |
Thanks for the update! |
Now there are relevant test failures, e.g.
(where the canceled job is handled as "finished" now, i.e. the test should get adjusted) As for running the tests locally, try |
I squashed the commits and I'll try to address the tests as well. Thanks for pointing out the related failures. |
In this case, the `exit_code` variable is removed from the context. The documentation and tests are updated accordingly. A related test was fixed. Changed the comparison value to 1 because now even the canceled jobs cause NeomakeJobFinished event to be sent.
I think it makes more sense to adjust autoload/neomake.vim | 1 -
tests/include/init.vim | 7 ++++++-
tests/processing.vader | 5 ++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git i/autoload/neomake.vim w/autoload/neomake.vim
index 2046dff5f..5be477761 100644
--- i/autoload/neomake.vim
+++ w/autoload/neomake.vim
@@ -1375,7 +1375,6 @@ function! s:CleanJobinfo(jobinfo, ...) abort
if has_key(a:jobinfo, 'exit_code')
call remove(a:jobinfo, 'exit_code')
endif
-
call neomake#utils#hook('NeomakeJobFinished', {'jobinfo': a:jobinfo})
endif
diff --git i/tests/include/init.vim w/tests/include/init.vim
index 04119b0b3..ddedee212 100644
--- i/tests/include/init.vim
+++ w/tests/include/init.vim
@@ -288,8 +288,13 @@ function! g:NeomakeSetupAutocmdWrappers()
endfunction
let g:neomake_test_jobfinished = []
+ let g:neomake_test_jobcanceled = []
function! s:OnNeomakeJobFinished(context)
- let g:neomake_test_jobfinished += [a:context]
+ if get(a:context.jobinfo, 'canceled', 0)
+ let g:neomake_test_jobcanceled += [a:context]
+ else
+ let g:neomake_test_jobfinished += [a:context]
+ endif
endfunction
let g:neomake_test_countschanged = []
diff --git i/tests/processing.vader w/tests/processing.vader
index a9059bc2b..2cd7fce2c 100644
--- i/tests/processing.vader
+++ w/tests/processing.vader
@@ -529,11 +529,14 @@ Execute (Handle finished job that got canceled (#1158)):
AssertNeomakeMessage 'Not processing output for mode "V".', 3
let jobs = neomake#Make(0, [g:success_maker])
AssertNeomakeMessage '\mCanceling already running job (\d\+.\d\+) for the same maker.'
- AssertEqual len(g:neomake_test_jobfinished), 1
+ AssertEqual len(g:neomake_test_jobfinished), 0
+ AssertEqual len(g:neomake_test_jobcanceled), 1
call neomake#CancelJob(jobs[0])
if neomake#has_async_support()
NeomakeTestsWaitForFinishedJobs
endif
+ AssertEqual len(g:neomake_test_jobfinished), 0
+ AssertEqual len(g:neomake_test_jobcanceled), 2
Execute (Job does not get restarted when canceled):
if NeomakeAsyncTestsSetup() Sorry for not reviewing it more properly before. |
Also I think that (I can push the above changes, and also add what I suggested above if you agree) |
Can you elaborate on this? I don't understand what you mean. I haven't thought about it before, but since we switched to the same event name for when a job is cancelled, removing the exit code will break existing configurations that rely on the You are right, it makes sense. You can push your changes. Please let me know If there's additional things I need to do. Do the changes you made take care of the tests? I can make additional changes if not. |
A job might handle e.g. SIGTERM and exit in a special way, and/or the signal status gets reflected there etc.
Cool, will do so later, probably tomorrow/during the week. I will take of the tests also. |
Closes issue #2492.