Open jbulow opened 1 year ago
I'm having this exact problem still, with utop-20230707.1535
installed from melpa today (I've had the problem for much longer but only got round to looking into it today). I also tried deleting the utop package and copying utop.el straight from this repository, with the same results. My Emacs version is 29.2. My utop version is 2.13.1 and OCaml is 5.1.1. \<TAB> is bound to utop-complete
.
Edit, next day: turns out I must've messed up when trying the changes in @steffenhaug's branch -- they fix the problem after all. I'll delete my extensive and pointless explanation below. Without the changes above, the completion stops in completion--nth-completion
(from minibuffer.el
) as no completion styles, at least in my Emacs, will match when given e.g "List.ap"
as the string
argument and just '("append")
as the table
.
There are still some cases where my version determines the incorrect completion prefix, but if I recall correctly, the status quo is broken in the same ways. It is a start, but it would be nice to also be able to complete in the middle of the input, and in the cases where the prefix isn't correctly determined by just looking for .
s.
Workaround: Turns out if you turn off merlin-mode
in the utop-buffer and then enable merlin-mode
again in the utop buffer, then utop suddenly gets full completions from merlin. So that means if you type List.
like in the example by @jbulow, you'll see all the completion candidates from the List module (tested with Corfu). What you don't get though, are symbols defined in the source buffer.
Here's an example: the hook turns merlin-mode
off and then on again:
(use-package utop
:ensure t
:custom
;; Utop will start with Dune project awareness:
(utop-command "opam exec -- dune utop . -- -emacs")
:hook
(tuareg-mode . utop-minor-mode)
;; HACK Workaround to get completions in Utop from Merlin
(utop-mode . (lambda ()
(merlin-mode -1)
(merlin-mode +1)))
:bind
;; Reach `utop' from anywhere via global key binding
(:map ctl-z-x-map
("u" . utop)))
Typing
Lis<TAB>
correctly completes into eitherList
orListLabels
but when typingList.<TAB>
a message "No match" appears in the minibuffer.