summaryrefslogtreecommitdiff
path: root/ale_linters/reason/ls.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-06-09 00:12:11 +0100
committerw0rp <devw0rp@gmail.com>2019-06-09 00:12:11 +0100
commit507f164a09d2cb3c99983424f9d186d6f4081820 (patch)
treef30d93c8448c2c6dce5bea17027764212274cf2e /ale_linters/reason/ls.vim
parent92d515c211716b5d046518547dba85f352e944b1 (diff)
downloadale-507f164a09d2cb3c99983424f9d186d6f4081820.zip
Document and test reason-language-server
Diffstat (limited to 'ale_linters/reason/ls.vim')
-rw-r--r--ale_linters/reason/ls.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/ale_linters/reason/ls.vim b/ale_linters/reason/ls.vim
new file mode 100644
index 00000000..fb1114ae
--- /dev/null
+++ b/ale_linters/reason/ls.vim
@@ -0,0 +1,23 @@
+" Author: David Buchan-Swanson <github@deecewan.com>
+" Description: Integrate ALE with reason-language-server.
+
+call ale#Set('reason_ls_executable', '')
+
+function! ale_linters#reason#ls#FindProjectRoot(buffer) abort
+ let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json')
+
+ if !empty(l:reason_config)
+ return fnamemodify(l:reason_config, ':h')
+ endif
+
+ return ''
+endfunction
+
+call ale#linter#Define('reason', {
+\ 'name': 'reason-language-server',
+\ 'lsp': 'stdio',
+\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
+\ 'command': '%e',
+\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'),
+\ 'language': 'reason',
+\})