summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorRisto Stevcev <risto1@gmail.com>2021-02-18 15:51:11 +0100
committerGitHub <noreply@github.com>2021-02-18 23:51:11 +0900
commit3ea887d2f4d43dd55d81213517344226f6399ed6 (patch)
treee5c15f7ef4cb7d6167215453cf71905e8808139f /autoload
parent1ee7f6c97bb73bb6e12f00e527b664c5ea0df167 (diff)
downloadale-3ea887d2f4d43dd55d81213517344226f6399ed6.zip
Added ocamllsp (#3595)
* Added ocamllsp * Update ordering in docs to be alphabetical * Updated expected result in test
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers/ocamllsp.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/handlers/ocamllsp.vim b/autoload/ale/handlers/ocamllsp.vim
new file mode 100644
index 00000000..07d9b0cf
--- /dev/null
+++ b/autoload/ale/handlers/ocamllsp.vim
@@ -0,0 +1,23 @@
+" Author: Risto Stevcev <me@risto.codes>
+" Description: Handlers for the official OCaml language server
+
+function! ale#handlers#ocamllsp#GetExecutable(buffer) abort
+ return 'ocamllsp'
+endfunction
+
+function! ale#handlers#ocamllsp#GetCommand(buffer) abort
+ let l:executable = ale#handlers#ocamllsp#GetExecutable(a:buffer)
+ let l:ocaml_ocamllsp_use_opam = ale#Var(a:buffer, 'ocaml_ocamllsp_use_opam')
+
+ return l:ocaml_ocamllsp_use_opam ? 'opam config exec -- ' . l:executable : l:executable
+endfunction
+
+function! ale#handlers#ocamllsp#GetLanguage(buffer) abort
+ return getbufvar(a:buffer, '&filetype')
+endfunction
+
+function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort
+ let l:dune_project_file = ale#path#FindNearestFile(a:buffer, 'dune-project')
+
+ return !empty(l:dune_project_file) ? fnamemodify(l:dune_project_file, ':h') : ''
+endfunction