Add ocaml-language-server for OCaml and ReasonML

This commit is contained in:
Michael Jungo authored and w0rp committed 2017-11-12 10:56:53 +00:00
1 parent 8e0d1f57c6
commit 39107a48b9
7 files changed
+104 -4

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
" Author: Michael Jungo <michaeljungo92@gmail.com>
" Description: Handlers for the OCaml language server
function! ale#handlers#ols#GetExecutable(buffer) abort
let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols'
return ale#node#FindExecutable(a:buffer, l:ols_setting, [
\ 'node_modules/.bin/ocaml-language-server',
\])
endfunction
function! ale#handlers#ols#GetCommand(buffer) abort
let l:executable = ale#handlers#ols#GetExecutable(a:buffer)
return ale#node#Executable(a:buffer, l:executable) . ' --stdio'
endfunction
function! ale#handlers#ols#GetLanguage(buffer) abort
return getbufvar(a:buffer, '&filetype')
endfunction
function! ale#handlers#ols#GetProjectRoot(buffer) abort
let l:merlin_file = ale#path#FindNearestFile(a:buffer, '.merlin')
return !empty(l:merlin_file) ? fnamemodify(l:merlin_file, ':h') : ''
endfunction