coding style

This commit is contained in:
Fred Emmott 2018-08-02 11:44:17 -07:00
parent 5ff4e27e17
commit e6bd4373f9
No known key found for this signature in database
GPG Key ID: 06C22A9D789FCA28
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ call ale#Set('hack_hhclient_executable', 'hh_client')
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
endfunction
@ -15,6 +16,7 @@ endfunction
function! ale_linters#hack#hack#GetCommand(buffer) abort
let l:executable = ale_linters#hack#hack#GetExecutable(a:buffer)
return ale#Escape(l:executable).' lsp --from vim-ale'
endfunction

View File

@ -5,10 +5,13 @@ call ale#Set('hack_hhast_executable', 'vendor/bin/hhast-lint')
function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
let l:root = ale_linters#hack#hack#GetProjectRoot(a:buffer)
if empty(l:root)
return ''
endif
let l:hhast_config = findfile('hhast-lint.json', l:root)
return !empty(l:hhast_config) ? l:root : ''
endfunction
@ -16,15 +19,19 @@ function! ale_linters#hack#hhast#GetExecutable(buffer) abort
let l:root = ale_linters#hack#hhast#GetProjectRoot(a:buffer)
let l:relative = ale#Var(a:buffer, 'hack_hhast_executable')
let l:absolute = findfile(l:relative, l:root)
return !empty(l:absolute) ? l:absolute : ''
endfunction
function! ale_linters#hack#hhast#GetCommand(buffer) abort
let l:executable = ale_linters#hack#hhast#GetExecutable(a:buffer)
return ale#Escape(l:executable).' --mode lsp --from vim-ale'
endfunction
function !
call ale#linter#Define('hack', {
\ 'name': 'hhast',
\ 'lsp': 'stdio',