X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/javascript/flow_ls.vim diff --git a/.vim/bundle/ale/ale_linters/javascript/flow_ls.vim b/.vim/bundle/ale/ale_linters/javascript/flow_ls.vim new file mode 100644 index 00000000..9755ca4e --- /dev/null +++ b/.vim/bundle/ale/ale_linters/javascript/flow_ls.vim @@ -0,0 +1,29 @@ +" Author: t_t +" Description: Integrate ALE with flow-language-server. + +call ale#Set('javascript_flow_ls_executable', 'flow') +call ale#Set('javascript_flow_ls_use_global', +\ get(g:, 'ale_use_global_executables', 0) +\) + +function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort + let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig') + + if !empty(l:flow_config) + return fnamemodify(l:flow_config, ':h') + endif + + return '' +endfunction + +call ale#linter#Define('javascript', { +\ 'name': 'flow_ls', +\ 'aliaes': ['flow-language-server'], +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ +\ 'node_modules/.bin/flow', +\ ])}, +\ 'command': '%e lsp --from ale-lsp', +\ 'project_root': function('ale_linters#javascript#flow_ls#FindProjectRoot'), +\ 'language': 'javascript', +\})