Skip to content

Conversation

@steffenhaug
Copy link

Fixes #455

The reason you don't get a completion when typing a symbol in a module, is because the range from utop-prompt-max to (point) does not match the actual prefix of the completion returned from utop. The fix is to set the start and end positions of the completion corresponding to the position of the prefix utop is actually completing.

Before, there was a fix that attempted to fix the same thing with some special logic in the processing of the lines returned from utop, but using the cadr of the split string will not work with more than one level of modules, and even then the range of the completion was not set correctly, leading to the issue. With this fix, we can complete things like List.<TAB>, and even Base.Float.O.<TAB>.

There might be a better way to determine the completion prefix; I'm not experienced enough with OCaml to know if splitting by . covers finding the prefix for everything that utop can autocomplete, but at least it is a start.

I'm also not the most experienced elisp hacker, so if the code is in bad style or there is something I have overlooked, feel free to make suggestions as to how I can improve the fix.

@Octachron
Copy link
Member

Octachron commented Jul 22, 2025

Superseded by #497 . Thanks for the potential fix, and sorry for the long absence of reactions.

@Octachron Octachron closed this Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Completion broken when running utop from emacs

2 participants