ocaml / merlin

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

Strange completions with some keywords in emacs with merlin-company-backend #1229

Open MonsieurPi opened 3 years ago

MonsieurPi commented 3 years ago

After let, if I hit tab or wait for the idle company delay I have this suggestion:

image

That's not bothering because I usually hit space after it.

But the main problem is with in, I have my idle company delay set to 0.1 seconds and as soon as I finish typing in:

image

Since I almost always press enter after it, I end up having to delete the t and press enter again to go to the next line.

Maybe there are other keywords behaving like this but I just noticed this with in and can't find a way to fix it.

Is it something I need to configure or something Merlin needs to fix?

trefis commented 3 years ago

Historically we've been encouraging people to configure their editor so that it doesn't automatically ask merlin for completion either at all, or without at least 3 characters as a prefix for the completion. This would sort your in troubles.

But another solution to the problem would be for merlin to complete keywords and not just idents. @rgrinberg has been asking this for a while (and proposed an implementation in #1137). I'll leave this issue open until that feature is merged.

Until then: I suggest you change your editor configuration as described.

ulugbekna commented 3 years ago

AFAIK, @rgrinberg's fork of merlin for ocaml-lsp already has keyword completion merged, see here.