mirror of
https://github.com/dense-analysis/ale
synced 2025-01-30 03:52:52 +00:00
Merge pull request #1736 from unpairedbracket/master
Add support for Fortran language server by @hansec
This commit is contained in:
commit
04fbea6e80
@ -119,7 +119,7 @@ formatting.
|
|||||||
| Erb | [erb](https://apidock.com/ruby/ERB), [erubi](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
|
| Erb | [erb](https://apidock.com/ruby/ERB), [erubi](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
|
||||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
||||||
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
|
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
|
||||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
| Fortran | [gcc](https://gcc.gnu.org/), [language_server](https://github.com/hansec/fortran-language-server) |
|
||||||
| Fountain | [proselint](http://proselint.com/) |
|
| Fountain | [proselint](http://proselint.com/) |
|
||||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
||||||
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
|
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
|
||||||
|
27
ale_linters/fortran/language_server.vim
Normal file
27
ale_linters/fortran/language_server.vim
Normal file
@ -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',
|
||||||
|
\})
|
@ -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.
|
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:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
@ -76,6 +76,7 @@ CONTENTS *ale-contents*
|
|||||||
fish..................................|ale-fish-options|
|
fish..................................|ale-fish-options|
|
||||||
fortran...............................|ale-fortran-options|
|
fortran...............................|ale-fortran-options|
|
||||||
gcc.................................|ale-fortran-gcc|
|
gcc.................................|ale-fortran-gcc|
|
||||||
|
language_server.....................|ale-fortran-language-server|
|
||||||
fountain..............................|ale-fountain-options|
|
fountain..............................|ale-fountain-options|
|
||||||
fusionscript..........................|ale-fuse-options|
|
fusionscript..........................|ale-fuse-options|
|
||||||
fusion-lint.........................|ale-fuse-fusionlint|
|
fusion-lint.........................|ale-fuse-fusionlint|
|
||||||
@ -355,7 +356,7 @@ Notes:
|
|||||||
* Erb: `erb`, `erubi`, `erubis`
|
* Erb: `erb`, `erubi`, `erubis`
|
||||||
* Erlang: `erlc`, `SyntaxErl`
|
* Erlang: `erlc`, `SyntaxErl`
|
||||||
* Fish: `fish` (-n flag)
|
* Fish: `fish` (-n flag)
|
||||||
* Fortran: `gcc`
|
* Fortran: `gcc`, `language_server`
|
||||||
* Fountain: `proselint`
|
* Fountain: `proselint`
|
||||||
* FusionScript: `fusion-lint`
|
* FusionScript: `fusion-lint`
|
||||||
* Git Commit Messages: `gitlint`
|
* Git Commit Messages: `gitlint`
|
||||||
|
2
test/command_callback/fortran-fortls-project/.fortls
Normal file
2
test/command_callback/fortran-fortls-project/.fortls
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
18
test/command_callback/test_fortran_fortls_callback.vader
Normal file
18
test/command_callback/test_fortran_fortls_callback.vader
Normal 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'
|
Loading…
Reference in New Issue
Block a user