Document and test reason-language-server

This commit is contained in:
w0rp 2019-06-09 00:12:11 +01:00
parent 92d515c211
commit 507f164a09
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
7 changed files with 49 additions and 17 deletions

View file

@ -1,7 +1,9 @@
" Author: David Buchan-Swanson <github@deecewan.com>
" Description: Integrate ALE with reason-language-server.
function! ale_linters#reason#reason_ls#FindProjectRoot(buffer) abort
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)
@ -14,8 +16,8 @@ endfunction
call ale#linter#Define('reason', {
\ 'name': 'reason-language-server',
\ 'lsp': 'stdio',
\ 'executable':{buffer -> ale#Var(buffer, 'reason_ls_executable')},
\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#reason#reason_ls#FindProjectRoot'),
\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'),
\ 'language': 'reason',
\})

View file

@ -5,18 +5,19 @@ ALE ReasonML Integration *ale-reasonml-options*
===============================================================================
merlin *ale-reasonml-merlin*
To use merlin linter for ReasonML source code you need to make sure Merlin
for Vim is correctly configured. See the corresponding Merlin wiki page for
detailed instructions
(https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch).
To use merlin linter for ReasonML source code you need to make sure Merlin for
Vim is correctly configured. See the corresponding Merlin wiki page for
detailed instructions:
https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch
===============================================================================
ols *ale-reasonml-ols*
The `ocaml-language-server` is the engine that powers OCaml and ReasonML
editor support using the Language Server Protocol. See the installation
instructions:
https://github.com/freebroccolo/ocaml-language-server#installation
The `ocaml-language-server` is the engine that powers OCaml and ReasonML
editor support using the Language Server Protocol. See the installation
instructions:
https://github.com/freebroccolo/ocaml-language-server#installation
g:ale_reason_ols_executable *g:ale_reason_ols_executable*
*b:ale_reason_ols_executable*
@ -25,6 +26,7 @@ g:ale_reason_ols_executable *g:ale_reason_ols_executable*
This variable can be set to change the executable path for `ols`.
g:ale_reason_ols_use_global *g:ale_reason_ols_use_global*
*b:ale_reason_ols_use_global*
Type: |String|
@ -33,16 +35,18 @@ g:ale_reason_ols_use_global *g:ale_reason_ols_use_global*
This variable can be set to `1` to always use the globally installed
executable. See also |ale-integrations-local-executables|.
===============================================================================
reason-language-server *ale-reasonml-language-server*
Note: You *must* set an executable - there is no 'default' install location.
Go to https://github.com/jaredly/reason-language-server and download the
latest release. You can place it anywhere, but ensure you set the executable
path.
Note: You *must* set an executable - there is no 'default' install location.
Go to https://github.com/jaredly/reason-language-server and download the
latest release. You can place it anywhere, but ensure you set the executable
path.
g:ale_reason_ls_executable *g:ale_reason_ls_executable*
*b:ale_reason_ls_executable*
g:ale_reason_ls_executable *g:ale_reason_ls_executable*
*b:ale_reason_ls_executable*
Type: |String|
This variable defines the standard location of the language server
@ -59,6 +63,7 @@ g:ale_reasonml_refmt_executable *g:ale_reasonml_refmt_executable*
This variable can be set to pass the path of the refmt fixer.
g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options*
*b:ale_reasonml_refmt_options*
Type: |String|
@ -66,5 +71,6 @@ g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options*
This variable can be set to pass additional options to the refmt fixer.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -366,6 +366,7 @@ Notes:
* ReasonML
* `merlin`
* `ols`
* `reason-language-server`
* `refmt`
* reStructuredText
* `alex`!!

View file

@ -2196,6 +2196,7 @@ documented in additional help files.
reasonml................................|ale-reasonml-options|
merlin................................|ale-reasonml-merlin|
ols...................................|ale-reasonml-ols|
reason-language-server................|ale-reasonml-language-server|
refmt.................................|ale-reasonml-refmt|
restructuredtext........................|ale-restructuredtext-options|
textlint..............................|ale-restructuredtext-textlint|

View file

@ -375,6 +375,7 @@ formatting.
* ReasonML
* [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions
* [ols](https://github.com/freebroccolo/ocaml-language-server)
* [reason-language-server](https://github.com/jaredly/reason-language-server)
* [refmt](https://github.com/reasonml/reason-cli)
* reStructuredText
* [alex](https://github.com/wooorm/alex) :floppy_disk:

View file

@ -0,0 +1,21 @@
Before:
call ale#assert#SetUpLinterTest('reason', 'ls')
After:
call ale#assert#TearDownLinterTest()
Execute(The linter should not be run by default):
AssertLinterNotExecuted
Execute(The executable should be configurable):
let b:ale_reason_ls_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar')
Execute(There should be no default project root):
AssertLSPProject ''
Execute(The project root should be detected using bsconfig.json):
call ale#test#SetFilename('reason_ls_paths/test.ml')
AssertLSPProject ale#path#Simplify(g:dir . '/reason_ls_paths')