summaryrefslogtreecommitdiff
path: root/ale_linters/fortran
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-07-20 21:05:24 +0100
committerGitHub <noreply@github.com>2018-07-20 21:05:24 +0100
commit04fbea6e80e010ffc242cc13daed6279f5d5aadf (patch)
tree244df0f15ce16a73259e98dbb4d54fec56277195 /ale_linters/fortran
parent0d37aaac7a6f2a6291d7db1032fe08196164fc73 (diff)
parentad986a8d821c343cafa363ebb4399fe589a373e1 (diff)
downloadale-04fbea6e80e010ffc242cc13daed6279f5d5aadf.zip
Merge pull request #1736 from unpairedbracket/master
Add support for Fortran language server by @hansec
Diffstat (limited to 'ale_linters/fortran')
-rw-r--r--ale_linters/fortran/language_server.vim27
1 files changed, 27 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..fd763fcf
--- /dev/null
+++ b/ale_linters/fortran/language_server.vim
@@ -0,0 +1,27 @@
+" 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#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')
+
+ 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#GetCommand',
+\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
+\})