summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CODE_OF_CONDUCT.md (renamed from CODE_OF_CONDUCT.md)0
-rw-r--r--.github/CONTRIBUTING.md (renamed from CONTRIBUTING.md)0
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md (renamed from PULL_REQUEST_TEMPLATE.md)0
-rw-r--r--README.md2
-rw-r--r--ale_linters/fortran/language_server.vim27
-rw-r--r--doc/ale-fortran.txt19
-rw-r--r--doc/ale.txt12
-rw-r--r--plugin/ale.vim5
-rw-r--r--test/command_callback/fortran-fortls-project/.fortls2
-rw-r--r--test/command_callback/test_fortran_fortls_callback.vader18
10 files changed, 77 insertions, 8 deletions
diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
index 587bb372..587bb372 100644
--- a/CODE_OF_CONDUCT.md
+++ b/.github/CODE_OF_CONDUCT.md
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index e59f8326..e59f8326 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 8e1b5c57..8e1b5c57 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
diff --git a/README.md b/README.md
index be237a65..99ea73ed 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ formatting.
| 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) |
| 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/) |
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
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',
+\})
diff --git a/doc/ale-fortran.txt b/doc/ale-fortran.txt
index ed6bc724..c9b7e8e2 100644
--- a/doc/ale-fortran.txt
+++ b/doc/ale-fortran.txt
@@ -33,4 +33,23 @@ g:ale_fortran_gcc_use_free_form *g:ale_fortran_gcc_use_free_form*
===============================================================================
+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:
diff --git a/doc/ale.txt b/doc/ale.txt
index bfef2bed..1a75c29c 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -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|
@@ -356,7 +357,7 @@ Notes:
* Erb: `erb`, `erubi`, `erubis`
* Erlang: `erlc`, `SyntaxErl`
* Fish: `fish` (-n flag)
-* Fortran: `gcc`
+* Fortran: `gcc`, `language_server`
* Fountain: `proselint`
* FusionScript: `fusion-lint`
* Git Commit Messages: `gitlint`
@@ -1414,8 +1415,7 @@ g:ale_set_balloons *g:ale_set_balloons*
*b:ale_set_balloons*
Type: |Number|
- Default: `(has('balloon_eval') && has('gui_running'))`
- `|| (has('balloon_eval_term') && !has('gui_running'))`
+ Default: `has('balloon_eval') && has('gui_running')`
When this option is set to `1`, balloon messages will be displayed for
problems or hover information if available.
@@ -1425,6 +1425,12 @@ g:ale_set_balloons *g:ale_set_balloons*
supporting "Hover" information, per |ale-hover|, then brief information
about the symbol under the cursor will be displayed in a balloon.
+ Balloons can be enabled for terminal versions of Vim that support balloons,
+ but some versions of Vim will produce strange mouse behavior when balloons
+ are enabled. To configure balloons for your terminal, you should first
+ configure your |ttymouse| setting, and then consider setting
+ `g:ale_set_balloons` to `1` before ALE is loaded.
+
`b:ale_set_balloons` can be set to `0` to disable balloons for a buffer.
Balloons cannot be enabled for a specific buffer when not initially enabled
globally.
diff --git a/plugin/ale.vim b/plugin/ale.vim
index ad2639bb..f0f90b6b 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -110,10 +110,7 @@ let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax'))
let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
" This flag can be set to 0 to disable balloon support.
-let g:ale_set_balloons = get(g:, 'ale_set_balloons',
-\ (has('balloon_eval') && has('gui_running'))
-\ || (has('balloon_eval_term') && !has('gui_running'))
-\)
+let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running'))
" This flag can be set to 0 to disable warnings for trailing whitespace
let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1)
diff --git a/test/command_callback/fortran-fortls-project/.fortls b/test/command_callback/fortran-fortls-project/.fortls
new file mode 100644
index 00000000..2c63c085
--- /dev/null
+++ b/test/command_callback/fortran-fortls-project/.fortls
@@ -0,0 +1,2 @@
+{
+}
diff --git a/test/command_callback/test_fortran_fortls_callback.vader b/test/command_callback/test_fortran_fortls_callback.vader
new file mode 100644
index 00000000..3be7ff4f
--- /dev/null
+++ b/test/command_callback/test_fortran_fortls_callback.vader
@@ -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'