I broke up with neovim....vim is my best friend now
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
function! ale#other_source#StartChecking(bufnr, name) abort
|
||||
let s:start_checking_called = [a:bufnr, a:name]
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#ShowResults(bufnr, name, results) abort
|
||||
let s:show_results_called = [a:bufnr, a:name, a:results]
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#last_start_checking() abort
|
||||
return s:start_checking_called
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#last_show_results() abort
|
||||
return s:show_results_called
|
||||
endfunction
|
||||
|
||||
function! WaitUntil(func, ...) abort
|
||||
let timeout = get(a:, 1, 1) " 1sec by default
|
||||
let total = 0
|
||||
while !a:func()
|
||||
sleep 100m
|
||||
let total += 0.1
|
||||
if total >= timeout
|
||||
" Note: v:true/v:false are not supported by themis.vim
|
||||
" https://github.com/thinca/vim-themis/pull/56
|
||||
return 0
|
||||
endif
|
||||
endwhile
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#wait_until_show_results() abort
|
||||
let timeout = 1
|
||||
let total = 0
|
||||
while s:show_results_called is v:null
|
||||
let total += 0.1
|
||||
if total > timeout
|
||||
throw 'ale#other_source#ShowResults() was not called while 1 second'
|
||||
endif
|
||||
sleep 100m
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#check_show_no_result() abort
|
||||
let timeout = 1
|
||||
let total = 0
|
||||
while s:show_results_called is v:null
|
||||
let total += 0.1
|
||||
if total > timeout
|
||||
return
|
||||
endif
|
||||
sleep 100m
|
||||
endwhile
|
||||
throw 'ale#other_source#ShowResults() was called within 1 second: ' . string(s:show_results_called)
|
||||
endfunction
|
||||
|
||||
function! ale#other_source#reset() abort
|
||||
let s:start_checking_called = v:null
|
||||
let s:show_results_called = v:null
|
||||
endfunction
|
||||
|
||||
call ale#other_source#reset()
|
||||
@@ -0,0 +1,2 @@
|
||||
function! lsp#stream() abort
|
||||
endfunction
|
||||
@@ -0,0 +1,35 @@
|
||||
function! lsp#callbag#pipe(source, filter, sink) abort
|
||||
let s:Filter = a:filter
|
||||
let s:Next = a:sink.next
|
||||
return {-> extend(s:, {'disposed': v:true})}
|
||||
endfunction
|
||||
|
||||
function! lsp#callbag#filter(pred) abort
|
||||
return a:pred
|
||||
endfunction
|
||||
|
||||
function! lsp#callbag#subscribe(sink) abort
|
||||
return a:sink
|
||||
endfunction
|
||||
|
||||
" Functions for tests
|
||||
|
||||
function! lsp#callbag#piped() abort
|
||||
return s:Filter isnot v:null && s:Next isnot v:null
|
||||
endfunction
|
||||
|
||||
function! lsp#callbag#disposed() abort
|
||||
return s:disposed
|
||||
endfunction
|
||||
|
||||
function! lsp#callbag#reset() abort
|
||||
let s:Filter = v:null
|
||||
let s:Next = v:null
|
||||
let s:disposed = v:false
|
||||
endfunction
|
||||
|
||||
function! lsp#callbag#mock_receive(res) abort
|
||||
if s:Filter(a:res)
|
||||
call s:Next(a:res)
|
||||
endif
|
||||
endfunction
|
||||
@@ -0,0 +1,7 @@
|
||||
function! lsp#internal#diagnostics#state#_is_enabled_for_buffer(bufnr) abort
|
||||
return a:bufnr == g:lsp_ale_test_mock_bufnr
|
||||
endfunction
|
||||
|
||||
function! lsp#internal#diagnostics#state#_get_all_diagnostics_grouped_by_server_for_uri(uri) abort
|
||||
return g:lsp_ale_test_mock_diags
|
||||
endfunction
|
||||
@@ -0,0 +1,19 @@
|
||||
function! lsp#ui#vim#utils#diagnostics_to_loc_list(res) abort
|
||||
if len(s:loclists) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let ret = s:loclists[0]
|
||||
let s:loclists = s:loclists[1:]
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! lsp#ui#vim#utils#mock_diagnostics_to_loc_list(loclists) abort
|
||||
let s:loclists = copy(a:loclists)
|
||||
endfunction
|
||||
|
||||
function! lsp#ui#vim#utils#reset() abort
|
||||
let s:loclists = []
|
||||
endfunction
|
||||
|
||||
call lsp#ui#vim#utils#reset()
|
||||
@@ -0,0 +1,11 @@
|
||||
function! lsp#utils#get_buffer_uri(bufnr) abort
|
||||
return 'file://' . s:bufname
|
||||
endfunction
|
||||
|
||||
function! lsp#utils#uri_to_path(uri) abort
|
||||
return s:bufname
|
||||
endfunction
|
||||
|
||||
function! lsp#utils#mock_buf_name(name) abort
|
||||
let s:bufname = a:name
|
||||
endfunction
|
||||
Reference in New Issue
Block a user