Add documentation and testing for fortls

This commit is contained in:
Ben Spiers 2018-07-19 22:27:47 +01:00
parent 324838adae
commit e8bea510df
4 changed files with 43 additions and 1 deletions

View File

@ -8,6 +8,10 @@ function! ale_linters#fortran#language_server#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'fortran_language_server_executable')
endfunction
function! ale_linters#fortran#language_server#GetCommand(buffer) abort
return ale#Escape(ale_linters#fortran#language_server#GetExecutable(a:buffer))
endfunction
function! ale_linters#fortran#language_server#GetProjectRoot(buffer) abort
let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls')
@ -18,6 +22,6 @@ call ale#linter#Define('fortran', {
\ 'name': 'language_server',
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#fortran#language_server#GetExecutable',
\ 'command_callback': 'ale_linters#fortran#language_server#GetExecutable',
\ 'command_callback': 'ale_linters#fortran#language_server#GetCommand',
\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
\})

View File

@ -32,5 +32,24 @@ g:ale_fortran_gcc_use_free_form *g:ale_fortran_gcc_use_free_form*
instead, for checking files with fixed form layouts.
===============================================================================
language_server *ale-fortran-language-server*
g:ale_fortran_language_server_executable *g:ale_fortran_language_server_executable*
*b:ale_fortran_language_server_executable*
Type: |String|
Default: `'fortls'`
This variable can be changed to modify the executable used for the Fortran
Language Server.
g:ale_fortran_language_server_use_global *g:ale_fortran_language_server_use_global*
*b:ale_fortran_language_server_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -76,6 +76,7 @@ CONTENTS *ale-contents*
fish..................................|ale-fish-options|
fortran...............................|ale-fortran-options|
gcc.................................|ale-fortran-gcc|
language_server.....................|ale-fortran-language-server|
fountain..............................|ale-fountain-options|
fusionscript..........................|ale-fuse-options|
fusion-lint.........................|ale-fuse-fusionlint|

View File

@ -0,0 +1,18 @@
Before:
call ale#assert#SetUpLinterTest('fortran', 'language_server')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'fortls', ale#Escape('fortls')
Execute(The project root should be detected correctly):
AssertLSPProject ''
call ale#test#SetFilename('fortran-fortls-project/test.F90')
AssertLSPProject ale#path#Simplify(g:dir . '/fortran-fortls-project')
Execute(The language should be correct):
AssertLSPLanguage 'fortran'