summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorBen Spiers <ben.spiers22@gmail.com>2018-07-19 18:25:45 +0100
committerBen Spiers <ben.spiers22@gmail.com>2018-07-19 18:47:37 +0100
commit324838adae32f4062c2099c297530588fb80a1a3 (patch)
treee115bd3d4d82004f33dfa2ded1450d6e8f99e0d2 /ale_linters
parent27f1915745d22a2d3831b3431a498d3ef674648c (diff)
downloadale-324838adae32f4062c2099c297530588fb80a1a3.zip
Add support for Fortran language server by @hansec
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/fortran/language_server.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/ale_linters/fortran/language_server.vim b/ale_linters/fortran/language_server.vim
new file mode 100644
index 00000000..c0dd51bf
--- /dev/null
+++ b/ale_linters/fortran/language_server.vim
@@ -0,0 +1,23 @@
+" Author: unpairedbracket ben.spiers22@gmail.com
+" Description: A language server for fortran
+
+call ale#Set('fortran_language_server_executable', 'fortls')
+call ale#Set('fortran_language_server_use_global', get(g:, 'ale_use_global_executables', 0))
+
+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#GetProjectRoot(buffer) abort
+ let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls')
+
+ return !empty(l:fortls_file) ? fnamemodify(l:fortls_file, ':h') : ''
+endfunction
+
+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',
+\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
+\})