diff options
author | w0rp <devw0rp@gmail.com> | 2018-10-29 18:28:28 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-10-29 18:28:28 +0000 |
commit | caac5c93d658c8ad05786194156a321e016d5ba0 (patch) | |
tree | 331f42c17491125fddacbbb33f60a3b3258da0ad /autoload/ale/engine.vim | |
parent | 2846e862178e9a16e078799c28aa9d9d4a2ea505 (diff) | |
download | ale-caac5c93d658c8ad05786194156a321e016d5ba0.zip |
#2017 Add support for display results from other sources
Diffstat (limited to 'autoload/ale/engine.vim')
-rw-r--r-- | autoload/ale/engine.vim | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 05db0e49..e85e4d66 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -79,6 +79,7 @@ function! ale#engine#InitBufferInfo(buffer) abort let g:ale_buffer_info[a:buffer] = { \ 'job_list': [], \ 'active_linter_list': [], + \ 'active_other_sources_list': [], \ 'loclist': [], \ 'temporary_file_list': [], \ 'temporary_directory_list': [], @@ -97,6 +98,7 @@ function! ale#engine#IsCheckingBuffer(buffer) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) return !empty(get(l:info, 'active_linter_list', [])) + \ || !empty(get(l:info, 'active_other_sources_list', [])) endfunction " Register a temporary file to be managed with the ALE engine for @@ -177,20 +179,27 @@ function! s:GatherOutput(job_id, line) abort endif endfunction -function! ale#engine#HandleLoclist(linter_name, buffer, loclist) abort +function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) if empty(l:info) return endif - " Remove this linter from the list of active linters. - " This may have already been done when the job exits. - call filter(l:info.active_linter_list, 'v:val isnot# a:linter_name') + if !a:from_other_source + " Remove this linter from the list of active linters. + " This may have already been done when the job exits. + call filter(l:info.active_linter_list, 'v:val isnot# a:linter_name') + endif " Make some adjustments to the loclists to fix common problems, and also " to set default values for loclist items. - let l:linter_loclist = ale#engine#FixLocList(a:buffer, a:linter_name, a:loclist) + let l:linter_loclist = ale#engine#FixLocList( + \ a:buffer, + \ a:linter_name, + \ a:from_other_source, + \ a:loclist, + \) " Remove previous items for this linter. call filter(l:info.loclist, 'v:val.linter_name isnot# a:linter_name') @@ -263,7 +272,7 @@ function! s:HandleExit(job_id, exit_code) abort let l:loclist = [] endtry - call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist) + call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist, 0) endfunction function! ale#engine#SetResults(buffer, loclist) abort @@ -335,7 +344,7 @@ function! s:RemapItemTypes(type_map, loclist) abort endfor endfunction -function! ale#engine#FixLocList(buffer, linter_name, loclist) abort +function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) abort let l:bufnr_map = {} let l:new_loclist = [] @@ -368,6 +377,10 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort \ 'linter_name': a:linter_name, \} + if a:from_other_source + let l:item.from_other_source = 1 + endif + if has_key(l:old_item, 'code') let l:item.code = l:old_item.code endif @@ -691,6 +704,7 @@ endfunction function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort " Figure out which linters are still enabled, and remove " problems for linters which are no longer enabled. + " Problems from other sources will be kept. let l:name_map = {} for l:linter in a:linters @@ -699,7 +713,7 @@ function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort call filter( \ get(g:ale_buffer_info[a:buffer], 'loclist', []), - \ 'get(l:name_map, get(v:val, ''linter_name''))', + \ 'get(v:val, ''from_other_source'') || get(l:name_map, get(v:val, ''linter_name''))', \) endfunction |