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

Emacs: merlin-sync-to-point freezes #320

Closed swsnr closed 9 years ago

swsnr commented 9 years ago

I wrote a Merlin syntax checker for Flycheck, which uses Merlin to highlight errors and warnings in the current buffer. The syntax checker calls (merlin-sync-to-point (point) t) to update Merlin and then asynchronously issues the errors command.

Flycheck can not only check after save, but also on-the-fly, while the user is typing. The former works fine with Merlin, but the latter does not: merlin-sync-to-buffer tends to freeze when called to frequently, which breaks on-the-fly checking.

Any idea where I could start to debug this issue?

let-def commented 9 years ago

By freezing you mean a complete freeze, not a lag? Does ctrl-g bring back control in emacs? It looks like a bug in the asynchronous processing in merlin.

swsnr commented 9 years ago

@def-lkb Yes, it freezes completely, but C-g brings back control.

let-def commented 9 years ago

I have setup flycheck and flycheck-ocaml (installed from melpa). I can't reproduce freeze (it seems you've slowed down the rate?).

swsnr commented 9 years ago

@def-lkb Yes, currently it only syncs after saving. You'll need to change the start function to unconditionally sync the buffer.

let-def commented 9 years ago

Latest master introduce a new implementation of asynchronous code in emacs mode. There were some race conditions, it seems fixed on my computer.

swsnr commented 9 years ago

@def-lkb Seems to be fixed for me as well. I'll update flycheck-ocaml, and see if anyone complains. Thanks for fixing this issue!

let-def commented 9 years ago

Great, thanks for flycheck-ocaml :)

swsnr commented 9 years ago

@def-lkb You are welcome! Thanks for Merlin :)