summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Popp <8mayday@gmail.com>2016-11-23 18:19:36 +0300
committerw0rp <w0rp@users.noreply.github.com>2016-11-23 15:19:36 +0000
commitf7e6236fe8c1e9a31750c6d13931e591b44b5e3d (patch)
treea9de0434a21a1a0c406b548188a236888297c8f8
parentd700da8cb803237d313a7cfa1824b610b3435a0a (diff)
downloadale-f7e6236fe8c1e9a31750c6d13931e591b44b5e3d.zip
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
-rw-r--r--README.md1
-rw-r--r--ale_linters/ocaml/merlin.vim19
-rw-r--r--doc/ale.txt32
3 files changed, 44 insertions, 8 deletions
diff --git a/README.md b/README.md
index 1737517f..68824df1 100644
--- a/README.md
+++ b/README.md
@@ -67,6 +67,7 @@ name. That seems to be the fairest way to arrange this table.
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
| Markdown | [mdl](https://github.com/mivok/markdownlint) |
| 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) |
| PHP | [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
diff --git a/ale_linters/ocaml/merlin.vim b/ale_linters/ocaml/merlin.vim
new file mode 100644
index 00000000..f8e0329e
--- /dev/null
+++ b/ale_linters/ocaml/merlin.vim
@@ -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',
+\})
+
diff --git a/doc/ale.txt b/doc/ale.txt
index 137d433d..6e38c73d 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -26,10 +26,13 @@ CONTENTS *ale-contents*
4.14. cpp-cppcheck..........................|ale-linter-options-cpp-cppcheck|
4.15. htmlhint..............................|ale-linter-options-htmlhint|
4.16. c-clang...............................|ale-linter-options-c-clang|
- 5. Commands/Keybinds..........................|ale-commands|
- 6. API........................................|ale-api|
- 7. Special Thanks.............................|ale-special-thanks|
- 8. Contact....................................|ale-contact|
+ 4.17. python-flake8.........................|ale-linter-options-python-flake8|
+ 5. Linter Integration Notes...................|ale-linter-integration|
+ 5.1. merlin................................|ale-linter-integration-ocaml-merlin|
+ 6. Commands/Keybinds..........................|ale-commands|
+ 7. API........................................|ale-api|
+ 8. Special Thanks.............................|ale-special-thanks|
+ 9. Contact....................................|ale-contact|
===============================================================================
1. Introduction *ale-introduction*
@@ -74,6 +77,7 @@ The following languages and tools are supported.
* Lua: 'luacheck'
* Markdown: 'mdl'
* MATLAB: 'mlint'
+* OCaml: 'merlin' (see |ale-linter-integration-ocaml-merlin|)
* Perl: 'perl' (-c flag), 'perlcritic'
* PHP: 'php' (-l flag), 'phpcs'
* 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.
`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*
ALEPreviousWrap *ALEPreviousWrap*
@@ -660,7 +676,7 @@ ALENextWrap *ALENextWrap*
<
===============================================================================
-6. API *ale-api*
+7. API *ale-api*
ale#Queue(delay) *ale#Queue()*
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
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
page for issues and more at https://github.com/w0rp/ale