Use a new window for the ALEFixSuggest command, and document it better

This commit is contained in:
w0rp
2017-06-28 16:20:01 +01:00
parent f883d4d4fd
commit 8846a8860f
5 changed files with 96 additions and 30 deletions

View File

@@ -1,15 +1,27 @@
Before:
call ale#fix#registry#Clear()
function GetSuggestions()
redir => l:output
silent ALEFixSuggest
redir END
let g:buffer = bufnr('')
return split(l:output, "\n")
function GetSuggestions()
silent ALEFixSuggest
if bufnr('') != g:buffer
let l:lines = getline(1, '$')
else
let l:lines = []
endif
return l:lines
endfunction
After:
if bufnr('') != g:buffer
:q!
endif
unlet! g:buffer
call ale#fix#registry#ResetToDefaults()
delfunction GetSuggestions
@@ -17,9 +29,18 @@ Execute(ALEFixSuggest should return something sensible with no suggestions):
AssertEqual
\ [
\ 'There is nothing in the registry to suggest.',
\ '',
\ 'Press q to close this window',
\ ],
\ GetSuggestions()
Execute(ALEFixSuggest should set the appropriate settings):
silent ALEFixSuggest
AssertEqual 'ale-fix-suggest', &filetype
Assert !&modified, 'The buffer was marked as modified'
Assert !&modifiable, 'The buffer was modifiable'
Execute(ALEFixSuggest output should be correct for only generic handlers):
call ale#fix#registry#Add('zed', 'XYZ', [], 'Zedify things.')
call ale#fix#registry#Add('alpha', 'XYZ', [], 'Alpha things.')
@@ -32,6 +53,8 @@ Execute(ALEFixSuggest output should be correct for only generic handlers):
\ '''zed'' - Zedify things.',
\ '',
\ 'See :help ale-fix-configuration',
\ '',
\ 'Press q to close this window',
\ ],
\ GetSuggestions()
@@ -49,6 +72,8 @@ Execute(ALEFixSuggest output should be correct for only filetype handlers):
\ '''zed'' - Zedify things.',
\ '',
\ 'See :help ale-fix-configuration',
\ '',
\ 'Press q to close this window',
\ ],
\ GetSuggestions()
@@ -71,5 +96,7 @@ Execute(ALEFixSuggest should suggest filetype and generic handlers):
\ '''generic'' - Generic things.',
\ '',
\ 'See :help ale-fix-configuration',
\ '',
\ 'Press q to close this window',
\ ],
\ GetSuggestions()