Skip to content

Commit

Permalink
Close #2132 - Add deprecation warnings for old features
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rp committed Apr 7, 2019
1 parent e85eb82 commit ce64e34
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
20 changes: 16 additions & 4 deletions autoload/ale/engine.vim
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,36 @@ endfunction
" Register a temporary file to be managed with the ALE engine for
" a current job run.
function! ale#engine#ManageFile(buffer, filename) abort
" TODO: Emit deprecation warning here later.
if !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom ''ale#engine#ManageFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

call ale#command#ManageFile(a:buffer, a:filename)
endfunction

" Same as the above, but manage an entire directory.
function! ale#engine#ManageDirectory(buffer, directory) abort
" TODO: Emit deprecation warning here later.
if !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom ''ale#engine#ManageDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

call ale#command#ManageDirectory(a:buffer, a:directory)
endfunction

function! ale#engine#CreateFile(buffer) abort
" TODO: Emit deprecation warning here later.
if !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom ''ale#engine#CreateFile is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

return ale#command#CreateFile(a:buffer)
endfunction

" Create a new temporary directory and manage it in one go.
function! ale#engine#CreateDirectory(buffer) abort
" TODO: Emit deprecation warning here later.
if !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom ''ale#engine#CreateDirectory is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

return ale#command#CreateDirectory(a:buffer)
endfunction

Expand Down
4 changes: 4 additions & 0 deletions autoload/ale/fix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort
let l:input = a:job_info.input
endif

if l:ChainCallback isnot v:null && !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom ''chain_with is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

let l:next_index = l:ChainCallback is v:null
\ ? a:job_info.callback_index + 1
\ : a:job_info.callback_index
Expand Down
8 changes: 7 additions & 1 deletion autoload/ale/linter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,13 @@ function! ale#linter#PreProcess(filetype, linter) abort
throw '`aliases` must be a List of String values'
endif

" TODO: Emit deprecation warnings for deprecated options later.
for l:key in filter(keys(l:obj), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''')
if !get(g:, 'ale_ignore_2_4_warnings')
execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

break
endfor

return l:obj
endfunction
Expand Down
8 changes: 4 additions & 4 deletions test/lsp/test_reset_lsp.vader
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Before:
call ale#linter#Define('testft', {
\ 'name': 'lsplinter',
\ 'lsp': 'tsserver',
\ 'executable_callback': 'EmptyString',
\ 'command_callback': 'EmptyString',
\ 'project_root_callback': 'EmptyString',
\ 'language_callback': 'EmptyString',
\ 'executable': function('EmptyString'),
\ 'command': function('EmptyString'),
\ 'project_root': function('EmptyString'),
\ 'language': function('EmptyString'),
\})

call ale#linter#Define('testft', {
Expand Down
2 changes: 2 additions & 0 deletions test/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ set ttimeoutlen=0
execute 'set encoding=utf-8'

let g:mapleader=','

let g:ale_ignore_2_4_warnings = 1

0 comments on commit ce64e34

Please sign in to comment.