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.
4 Save g:ale_lsp_suggestions
6 let g:ale_disable_lsp = 0
7 let g:ale_lsp_suggestions = 1
8 unlet! b:ale_disable_lsp
10 function! CreateError(type, message) abort
11 let l:diagnostics = []
14 let l:diagnostics = [{
15 \ 'start': {'line': 1, 'offset': 1},
16 \ 'end': {'line': 1, 'offset':1},
26 \ 'body': {'file': expand('%:p'), 'diagnostics': l:diagnostics},
30 function! CreateLoclist(message) abort
46 call ale#test#SetDirectory('/testplugin/test')
47 call ale#test#SetFilename('filename.ts')
49 runtime autoload/ale/engine.vim
51 let g:ale_buffer_info = {bufnr(''): {'loclist': [], 'active_linter_list': []}}
52 let g:ale_handle_loclist_called = 0
54 function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
55 let g:ale_handle_loclist_called = 1
61 delfunction CreateError
62 delfunction CreateLoclist
64 call ale#test#RestoreDirectory()
66 runtime autoload/ale/engine.vim
68 Execute(An initial empty list of syntax errors should be ignored):
69 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
71 Assert !g:ale_handle_loclist_called
73 Execute(An initial list of syntax errors should be handled):
74 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
76 Assert g:ale_handle_loclist_called
78 Execute(Subsequent empty lists should be ignored):
79 let g:ale_buffer_info[bufnr('')].syntax_loclist = []
81 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
83 Assert !g:ale_handle_loclist_called
85 Execute(Empty then non-empty syntax errors should be handled):
86 let g:ale_buffer_info[bufnr('')].syntax_loclist = []
88 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
90 Assert g:ale_handle_loclist_called
92 Execute(Non-empty then empty syntax errors should be handled):
93 let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
95 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
97 Assert g:ale_handle_loclist_called
99 Execute(Non-empty then non-empty syntax errors should be handled):
100 let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
102 call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
104 Assert g:ale_handle_loclist_called
106 Execute(An initial empty list of semantic errors should be ignored):
107 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
109 Assert !g:ale_handle_loclist_called
111 Execute(An initial list of semantic errors should be handled):
112 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
114 Assert g:ale_handle_loclist_called
116 Execute(Subsequent empty lists should be ignored - semantic):
117 let g:ale_buffer_info[bufnr('')].semantic_loclist = []
119 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
121 Assert !g:ale_handle_loclist_called
123 Execute(Empty then non-empty semantic errors should be handled):
124 let g:ale_buffer_info[bufnr('')].semantic_loclist = []
126 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
128 Assert g:ale_handle_loclist_called
130 Execute(Non-empty then empty semantic errors should be handled):
131 let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
133 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
135 Assert g:ale_handle_loclist_called
137 Execute(Non-empty then non-empty semantic errors should be handled):
138 let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
140 call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
142 Assert g:ale_handle_loclist_called
144 Execute(Subsequent empty lists should be ignored - suggestion):
145 let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
147 call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
149 Assert !g:ale_handle_loclist_called
151 Execute(You should be able to disable suggestions):
152 let g:ale_lsp_suggestions = 0
153 let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
155 call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
157 Assert !g:ale_handle_loclist_called
159 Execute(Empty then non-empty suggestion messages should be handled):
160 let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
162 call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
164 Assert g:ale_handle_loclist_called
166 Execute(Non-empty then empt suggestion messages should be handled):
167 let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
169 call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
171 Assert g:ale_handle_loclist_called
173 Execute(Non-empty then non-empty suggestion messages should be handled):
174 let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
176 call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
178 Assert g:ale_handle_loclist_called