All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 let s:SEP = has('win32') ? '\' : '/'
3 function! s:get_debug_info(bufnr) abort
4 let uri = lsp#utils#get_buffer_uri(a:bufnr)
5 let all_diags = lsp#internal#diagnostics#state#_get_all_diagnostics_grouped_by_server_for_uri(uri)
6 return "\nall diags: " . string(all_diags)
7 \ . "\nlocation list: " . string(ale#engine#GetLoclist(a:bufnr))
8 \ . "\nserver_status: " . lsp#get_server_status()
9 \ . "\ncurrent lines: " . string(getline(1, '$'))
12 Describe rust-analyzer
14 if !executable('rust-analyzer')
15 throw 'rust-analyzer command is not found. It must be installed for running integration tests'
18 let dir = IntegTestRootDir()
20 let file = join([dir, 'project', 'src', 'lib.rs'], s:SEP)
22 " Note: It might be better to write lib.rs here and delete in `After all` hook rather than
23 " modifying a file committed to repository directly.
24 let lib_rs_contents = readfile(file)
28 " Restore contents of lib.rs since it was modified by test case
29 call writefile(lib_rs_contents, file)
31 redir! > integ_messages.txt
32 if exists(':LspStatus')
35 echom 'No :LspStatus command is defined'
49 It shows diagnostics results with ALE through vim-lsp
50 Assert lsp#ale#enabled()
54 let elapsed = 0 " in seconds
55 let timeout = 120 " in seconds
56 let counts = ale#statusline#Count(bufnr)
57 while elapsed <= timeout
63 let counts = ale#statusline#Count(bufnr)
66 let info = s:get_debug_info(bufnr)
67 Assert True(counts.total > 0, 'No error found after ' . elapsed . ' seconds' . info)
69 let loclist = ale#engine#GetLoclist(bufnr)
70 Assert NotEmpty(loclist, 'Location list from ALE is empty after ' . elapsed . ' seconds. ' . info)
73 let item_str = string(item)
74 Assert Equals(item.linter_name, 'vim-lsp', item_str . info)
75 Assert True(item.from_other_source, item_str . info)
76 Assert Match(item.filename, 'lib\.rs$', item_str . info)
77 Assert Match(item.text, 'this_variable_is_unused', item_str . info)
83 let elapsed = 0 " in seconds
84 let counts = ale#statusline#Count(bufnr)
85 while elapsed <= timeout
91 let counts = ale#statusline#Count(bufnr)
94 let info = s:get_debug_info(bufnr)
95 Assert True(counts.total == 0, 'Error found after ' . elapsed . ' seconds' . info)
97 " Check the error was removed from location list since it'd been fixed
98 let loclist = ale#engine#GetLoclist(bufnr)
99 Assert Empty(loclist, 'Location list from ALE is not empty after ' . elapsed . ' seconds. ' . info)