1
0
mirror of https://github.com/amix/vimrc synced 2025-06-24 07:44:59 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-06-14 12:31:12 +02:00
parent 7288aee801
commit 3e3297af67
273 changed files with 11821 additions and 5377 deletions

View File

@ -28,8 +28,6 @@ function! ale#fix#ApplyQueuedFixes() abort
call remove(g:ale_fix_buffer_data, l:buffer)
if l:data.changes_made
call setline(1, l:data.output)
let l:start_line = len(l:data.output) + 1
let l:end_line = len(l:data.lines_before)
@ -39,6 +37,8 @@ function! ale#fix#ApplyQueuedFixes() abort
call winrestview(l:save)
endif
call setline(1, l:data.output)
if l:data.should_save
if empty(&buftype)
noautocmd :w!
@ -356,14 +356,16 @@ function! s:RunFixer(options) abort
call ale#fix#ApplyFixes(l:buffer, l:input)
endfunction
function! s:GetCallbacks() abort
if type(get(b:, 'ale_fixers')) is type([])
function! s:GetCallbacks(buffer, linters) abort
if len(a:linters)
let l:callback_list = a:linters
elseif type(get(b:, 'ale_fixers')) is type([])
" Lists can be used for buffer-local variables only
let l:callback_list = b:ale_fixers
else
" buffer and global options can use dictionaries mapping filetypes to
" callbacks to run.
let l:fixers = ale#Var(bufnr(''), 'fixers')
let l:fixers = ale#Var(a:buffer, 'fixers')
let l:callback_list = []
for l:sub_type in split(&filetype, '\.')
@ -422,19 +424,13 @@ endfunction
" Accepts an optional argument for what to do when fixing.
"
" Returns 0 if no fixes can be applied, and 1 if fixing can be done.
function! ale#fix#Fix(...) abort
if len(a:0) > 1
throw 'too many arguments!'
endif
let l:fixing_flag = get(a:000, 0, '')
if l:fixing_flag isnot# '' && l:fixing_flag isnot# 'save_file'
function! ale#fix#Fix(buffer, fixing_flag, ...) abort
if a:fixing_flag isnot# '' && a:fixing_flag isnot# 'save_file'
throw "fixing_flag must be either '' or 'save_file'"
endif
try
let l:callback_list = s:GetCallbacks()
let l:callback_list = s:GetCallbacks(a:buffer, a:000)
catch /E700\|BADNAME/
let l:function_name = join(split(split(v:exception, ':')[3]))
let l:echo_message = printf(
@ -447,29 +443,27 @@ function! ale#fix#Fix(...) abort
endtry
if empty(l:callback_list)
if l:fixing_flag is# ''
if a:fixing_flag is# ''
execute 'echom ''No fixers have been defined. Try :ALEFixSuggest'''
endif
return 0
endif
let l:buffer = bufnr('')
for l:job_id in keys(s:job_info_map)
call remove(s:job_info_map, l:job_id)
call ale#job#Stop(l:job_id)
endfor
" Clean up any files we might have left behind from a previous run.
call ale#fix#RemoveManagedFiles(l:buffer)
call ale#fix#InitBufferData(l:buffer, l:fixing_flag)
call ale#fix#RemoveManagedFiles(a:buffer)
call ale#fix#InitBufferData(a:buffer, a:fixing_flag)
silent doautocmd <nomodeline> User ALEFixPre
call s:RunFixer({
\ 'buffer': l:buffer,
\ 'input': g:ale_fix_buffer_data[l:buffer].lines_before,
\ 'buffer': a:buffer,
\ 'input': g:ale_fix_buffer_data[a:buffer].lines_before,
\ 'callback_index': 0,
\ 'callback_list': l:callback_list,
\})