Skip to content

Commit 70405d8

Browse files
committed
Move ALE integration logic into autoload function
1 parent cb3aa0b commit 70405d8

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

autoload/ale/sources/OmniSharp.vim

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
function! ale#sources#OmniSharp#WantResults(buffer) abort
2-
let g:OmniSharp_diagnostics_requested = 1
1+
function! ale#sources#OmniSharp#WantResults() abort
2+
if !g:OmniSharp_server_stdio | return | endif
3+
let bufnr = g:ale_want_results_buffer
4+
if getbufvar(bufnr, '&filetype') !=# 'cs' | return | endif
35
if OmniSharp#FugitiveCheck() | return | endif
4-
call ale#other_source#StartChecking(a:buffer, 'OmniSharp')
5-
let opts = { 'BufNum': a:buffer }
6+
let g:OmniSharp_diagnostics_requested = 1
7+
call ale#other_source#StartChecking(bufnr, 'OmniSharp')
8+
let opts = { 'BufNum': bufnr }
69
let Callback = function('ale#sources#OmniSharp#ProcessResults', [opts])
7-
call OmniSharp#actions#diagnostics#StdioCheck(a:buffer, Callback)
10+
call OmniSharp#actions#diagnostics#StdioCheck(bufnr, Callback)
811
endfunction
912

1013
function! ale#sources#OmniSharp#ProcessResults(opts, locations) abort

plugin/OmniSharp.vim

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ command! -bar -bang OmniSharpStatus call OmniSharp#Status(<bang>0)
5353
" Preserve backwards compatibility with older version g:OmniSharp_highlight_types
5454
let g:OmniSharp_highlighting = get(g:, 'OmniSharp_highlighting', get(g:, 'OmniSharp_highlight_types', 2))
5555

56-
function! s:ALEWantResults() abort
57-
if !g:OmniSharp_server_stdio | return | endif
58-
if getbufvar(g:ale_want_results_buffer, '&filetype') ==# 'cs'
59-
call ale#sources#OmniSharp#WantResults(g:ale_want_results_buffer)
60-
endif
61-
endfunction
62-
6356
augroup OmniSharp_Integrations
6457
autocmd!
6558

@@ -82,7 +75,7 @@ augroup OmniSharp_Integrations
8275
\})
8376

8477
" Listen for ALE requests
85-
autocmd User ALEWantResults call s:ALEWantResults()
78+
autocmd User ALEWantResults call ale#sources#OmniSharp#WantResults()
8679
augroup END
8780

8881
if !exists('g:OmniSharp_selector_ui')

0 commit comments

Comments
 (0)