Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix completion of symbols in modules #468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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
1 participant