File: hack.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (22 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
" Author: Fred Emmott <fe@fb.com>
" Description: Hack support via `hack lsp`

call ale#Set('hack_hack_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

function! ale_linters#hack#hack#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'hack_hack_executable')
endfunction

call ale#linter#Define('hack', {
\   'name': 'hack',
\   'lsp': 'stdio',
\   'executable': function('ale_linters#hack#hack#GetExecutable'),
\   'command': '%e lsp --from vim-ale',
\   'project_root': function('ale_linters#hack#hack#GetProjectRoot'),
\})