summaryrefslogtreecommitdiff
path: root/autoload/ale/handlers/ols.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/handlers/ols.vim')
-rw-r--r--autoload/ale/handlers/ols.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/handlers/ols.vim b/autoload/ale/handlers/ols.vim
new file mode 100644
index 00000000..1dda7f92
--- /dev/null
+++ b/autoload/ale/handlers/ols.vim
@@ -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