@@ -4,8 +4,8 @@ set cpoptions&vim
44" Accepts a Funcref callback argument, to be called after the response is
55" returned (synchronously or asynchronously) with the results
66function ! OmniSharp#actions#diagnostics#Check (... ) abort
7- let opts = a: 0 && a: 1 isnot 0 ? { ' Callback' : a: 1 } : {}
87 if bufname (' %' ) == # ' ' || OmniSharp#FugitiveCheck () | return [] | endif
8+ let opts = a: 0 && a: 1 isnot 0 ? { ' Callback' : a: 1 } : {}
99 if pumvisible () || ! OmniSharp#IsServerRunning ()
1010 let b: codecheck = get (b: , ' codecheck' , [])
1111 if has_key (opts, ' Callback' )
@@ -23,11 +23,18 @@ function! OmniSharp#actions#diagnostics#Check(...) abort
2323 endif
2424endfunction
2525
26+ " Find all solution/project diagnostics and populate the quickfix list.
27+ " Optional argument:
28+ " Callback: When a callback is passed in, the diagnostics will be sent to
29+ " the callback *instead of* to the quickfix list.
2630function ! OmniSharp#actions#diagnostics#CheckGlobal (... ) abort
2731 if bufname (' %' ) == # ' ' || OmniSharp#FugitiveCheck () | return [] | endif
28- " Place the results in the quickfix window, if possible
29- if g: OmniSharp_server_stdio
32+ if a: 0 && a: 1 isnot 0
33+ let Callback = a: 1
34+ else
3035 let Callback = function (' s:CBGlobalCodeCheck' )
36+ endif
37+ if g: OmniSharp_server_stdio
3138 let opts = {
3239 \ ' ResponseHandler' : function (' s:StdioCheckRH' , [Callback])
3340 \}
@@ -36,7 +43,7 @@ function! OmniSharp#actions#diagnostics#CheckGlobal(...) abort
3643 else
3744 let quickfixes = OmniSharp#py#Eval (' globalCodeCheck()' )
3845 if OmniSharp#py#CheckForError () | return | endif
39- call s: CBGlobalCodeCheck (quickfixes)
46+ call Callback (quickfixes)
4047 endif
4148endfunction
4249
0 commit comments