ocaml / merlin

Context sensitive completion for OCaml in Vim and Emacs
https://ocaml.github.io/merlin/
MIT License
1.57k stars 233 forks source link

Please support .mll and .mly #356

Open edwintorok opened 9 years ago

edwintorok commented 9 years ago

When editing mll or mly files I always get errors shown in Vim:

{
   open Types

Syntax error, expecting <record_expr>

%token <char> CHAR

Syntax error, expecting '#' or expression

Alternatively disable merlin for mll and mly.

let-def commented 9 years ago

Support for mll and mly will be a good showcase for merlin flexible parsing infrastructure… The most difficult part is lexing. Also, since everything is mutually recursive in an mly, it might be challenging to ensure good performance.

This is a long-time work, in the meantime you can apply:

diff --git a/vim/merlin/ftplugin/ocaml.vim b/vim/merlin/ftplugin/ocaml.vim
index 2e33e14..7a58efa 100644
--- a/vim/merlin/ftplugin/ocaml.vim
+++ b/vim/merlin/ftplugin/ocaml.vim
@@ -1,2 +1,5 @@
 " Activate merlin on current buffer
+if index(['mll','mly'], expand('%:e')) >= 0
+  finish
+endif
 call merlin#Register()
alexandramedway commented 8 years ago

That patch didn't change anything for me, I'm still getting the same warnings and errors. How can I disable these?

rgrinberg commented 8 years ago

@alexandramedway @def-lkb Imo the better workaround if you're using syntastic is:

let g:syntastic_ignore_files = ['\m\c\.ml[ly]$']

Don't need to hack your merlin this way.

alexandramedway commented 8 years ago

That worked, thanks! Really appreciate your help @rgrinberg :)