Add ocaml linter: merlin (#177)

* Add ocaml linter: merlin

* Add docs for ocaml-merlin integration.

* Remove annoying error message from ocaml merlin linter

* Update doc to list merlin linter
This commit is contained in:
Andrey Popp 2016-11-23 18:19:36 +03:00 committed by w0rp
parent d700da8cb8
commit f7e6236fe8
3 changed files with 44 additions and 8 deletions

View File

@ -67,6 +67,7 @@ name. That seems to be the fairest way to arrange this table.
| Lua | [luacheck](https://github.com/mpeterv/luacheck) | | Lua | [luacheck](https://github.com/mpeterv/luacheck) |
| Markdown | [mdl](https://github.com/mivok/markdownlint) | | Markdown | [mdl](https://github.com/mivok/markdownlint) |
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) | | MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-ocaml-merlin` for configuration instructions
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) | | Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
| PHP | [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) | | PHP | [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) | | Pug | [pug-lint](https://github.com/pugjs/pug-lint) |

View File

@ -0,0 +1,19 @@
" Author: Andrey Popp -- @andreypopp
" Description: Report errors in OCaml code with Merlin
if !exists('g:merlin')
finish
endif
function! ale_linters#ocaml#merlin#Handle(buffer, lines)
let l:errors = merlin#ErrorLocList()
return l:errors
endfunction
call ale#linter#Define('ocaml', {
\ 'name': 'merlin',
\ 'executable': 'ocamlmerlin',
\ 'command': 'true',
\ 'callback': 'ale_linters#ocaml#merlin#Handle',
\})

View File

@ -26,10 +26,13 @@ CONTENTS *ale-contents*
4.14. cpp-cppcheck..........................|ale-linter-options-cpp-cppcheck| 4.14. cpp-cppcheck..........................|ale-linter-options-cpp-cppcheck|
4.15. htmlhint..............................|ale-linter-options-htmlhint| 4.15. htmlhint..............................|ale-linter-options-htmlhint|
4.16. c-clang...............................|ale-linter-options-c-clang| 4.16. c-clang...............................|ale-linter-options-c-clang|
5. Commands/Keybinds..........................|ale-commands| 4.17. python-flake8.........................|ale-linter-options-python-flake8|
6. API........................................|ale-api| 5. Linter Integration Notes...................|ale-linter-integration|
7. Special Thanks.............................|ale-special-thanks| 5.1. merlin................................|ale-linter-integration-ocaml-merlin|
8. Contact....................................|ale-contact| 6. Commands/Keybinds..........................|ale-commands|
7. API........................................|ale-api|
8. Special Thanks.............................|ale-special-thanks|
9. Contact....................................|ale-contact|
=============================================================================== ===============================================================================
1. Introduction *ale-introduction* 1. Introduction *ale-introduction*
@ -74,6 +77,7 @@ The following languages and tools are supported.
* Lua: 'luacheck' * Lua: 'luacheck'
* Markdown: 'mdl' * Markdown: 'mdl'
* MATLAB: 'mlint' * MATLAB: 'mlint'
* OCaml: 'merlin' (see |ale-linter-integration-ocaml-merlin|)
* Perl: 'perl' (-c flag), 'perlcritic' * Perl: 'perl' (-c flag), 'perlcritic'
* PHP: 'php' (-l flag), 'phpcs' * PHP: 'php' (-l flag), 'phpcs'
* Pug: 'pug-lint' * Pug: 'pug-lint'
@ -626,9 +630,21 @@ Python 3, you may want to set >
after making sure it's installed for the appropriate Python versions (e.g. after making sure it's installed for the appropriate Python versions (e.g.
`python3 -m pip install --user flake8`). `python3 -m pip install --user flake8`).
===============================================================================
5. Linter Integration Notes *ale-linter-integration*
Some linters may have requirements for some other plugins being installed.
-------------------------------------------------------------------------------
5.1. ocaml-merlin *ale-integration-ocaml-merlin*
To use merlin linter for OCaml source code you need to make sure Merlin for
Vim is correctly configured. See the corresponding Merlin wiki page for
detailed instructions
(https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch).
=============================================================================== ===============================================================================
5. Commands/Keybinds *ale-commands* 6. Commands/Keybinds *ale-commands*
ALEPrevious *ALEPrevious* ALEPrevious *ALEPrevious*
ALEPreviousWrap *ALEPreviousWrap* ALEPreviousWrap *ALEPreviousWrap*
@ -660,7 +676,7 @@ ALENextWrap *ALENextWrap*
< <
=============================================================================== ===============================================================================
6. API *ale-api* 7. API *ale-api*
ale#Queue(delay) *ale#Queue()* ale#Queue(delay) *ale#Queue()*
Run linters for the current buffer, based on the filetype of the buffer, Run linters for the current buffer, based on the filetype of the buffer,
@ -782,13 +798,13 @@ ALELint *ALELint*
=============================================================================== ===============================================================================
7. Special Thanks *ale-special-thanks* 8. Special Thanks *ale-special-thanks*
Special thanks to Mark Grealish (https://www.bhalash.com/) for providing ALE's Special thanks to Mark Grealish (https://www.bhalash.com/) for providing ALE's
snazzy looking ale glass logo. Cheers, Mark! snazzy looking ale glass logo. Cheers, Mark!
=============================================================================== ===============================================================================
8. Contact *ale-contact* 9. Contact *ale-contact*
If you like this plugin, and wish to get in touch, check out the GitHub If you like this plugin, and wish to get in touch, check out the GitHub
page for issues and more at https://github.com/w0rp/ale page for issues and more at https://github.com/w0rp/ale