mirror of
https://github.com/dense-analysis/ale
synced 2024-12-24 15:13:02 +00:00
coding style
This commit is contained in:
parent
5ff4e27e17
commit
e6bd4373f9
@ -5,6 +5,7 @@ call ale#Set('hack_hhclient_executable', 'hh_client')
|
|||||||
|
|
||||||
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
||||||
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||||
|
|
||||||
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#hack#hack#GetCommand(buffer) abort
|
function! ale_linters#hack#hack#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#hack#hack#GetExecutable(a:buffer)
|
let l:executable = ale_linters#hack#hack#GetExecutable(a:buffer)
|
||||||
|
|
||||||
return ale#Escape(l:executable).' lsp --from vim-ale'
|
return ale#Escape(l:executable).' lsp --from vim-ale'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -5,10 +5,13 @@ call ale#Set('hack_hhast_executable', 'vendor/bin/hhast-lint')
|
|||||||
|
|
||||||
function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
|
function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort
|
||||||
let l:root = ale_linters#hack#hack#GetProjectRoot(a:buffer)
|
let l:root = ale_linters#hack#hack#GetProjectRoot(a:buffer)
|
||||||
|
|
||||||
if empty(l:root)
|
if empty(l:root)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:hhast_config = findfile('hhast-lint.json', l:root)
|
let l:hhast_config = findfile('hhast-lint.json', l:root)
|
||||||
|
|
||||||
return !empty(l:hhast_config) ? l:root : ''
|
return !empty(l:hhast_config) ? l:root : ''
|
||||||
endfunction
|
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:root = ale_linters#hack#hhast#GetProjectRoot(a:buffer)
|
||||||
let l:relative = ale#Var(a:buffer, 'hack_hhast_executable')
|
let l:relative = ale#Var(a:buffer, 'hack_hhast_executable')
|
||||||
let l:absolute = findfile(l:relative, l:root)
|
let l:absolute = findfile(l:relative, l:root)
|
||||||
|
|
||||||
return !empty(l:absolute) ? l:absolute : ''
|
return !empty(l:absolute) ? l:absolute : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! ale_linters#hack#hhast#GetCommand(buffer) abort
|
function! ale_linters#hack#hhast#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#hack#hhast#GetExecutable(a:buffer)
|
let l:executable = ale_linters#hack#hhast#GetExecutable(a:buffer)
|
||||||
|
|
||||||
return ale#Escape(l:executable).' --mode lsp --from vim-ale'
|
return ale#Escape(l:executable).' --mode lsp --from vim-ale'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function !
|
||||||
|
|
||||||
call ale#linter#Define('hack', {
|
call ale#linter#Define('hack', {
|
||||||
\ 'name': 'hhast',
|
\ 'name': 'hhast',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
|
Loading…
Reference in New Issue
Block a user