ocaml / merlin

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

Need a way to debug why there is no auto-completion at times #71

Closed roshanjames closed 11 years ago

roshanjames commented 11 years ago

I think this issue is a repeat of other issues where I have asked for some debug information printing. This issue merely includes a specific example.

For following little file, sometimes I see completion results for the module M and sometime I dont. When I don't doing a merlin-rewind or a merlin-restart-process fixes it. However doing a merlin-to-point does not seem to flag any errors. Can we display something about the internal state of merlin in such cases to try and track down how it got into a bad state?

open Core.Std

module M = struct open Float

type t = int

let to_string = to_string end

let _ = M.{M-/}

roshanjames commented 11 years ago

screenshot from 2013-08-17 00 03 35

This is related. Even after I delete the type t from M, the dropdown seems to show it. Is the user expected to hit rewind or refresh after edits?

asmanur commented 11 years ago

On ven. 16/août 2013 (21:10), Roshan James wrote:

screenshot from 2013-08-17 00 03 35

This is related. Even after I delete the type t from M, the dropdown seems to show it. Is the user expected to hit rewind or refresh after edits?

No it is not. When you edit, the function merlin-edit is called and retracts the merlin locked zone before the point. However I cannot reproduce your bug, on my computer it works well.

let-def commented 11 years ago

I reproduced the bug on my computer and just pushed a fix.

The problem was that emacs mode was not tracking modifications done to existing content in the buffer (merlin-lock-point is not enough, it only tells the position of the cursor on merlin-side, but merlin is not aware of modifications).

let-def commented 11 years ago

I was wrong, there was a bug in one merlin command hiding another synchronization problem… We will push a fix asap!

roshanjames commented 11 years ago

Do let me know when you are ready and I'll test at my end.

roshanjames commented 11 years ago

@def-lkb I pulled the latest and built. I think your synchronization patch seems good.

roshanjames commented 11 years ago

Here is an instance of auto-complete not working. The buffer is in the following form:

screenshot from 2013-08-17 23 56 02

Note that it understands the submodule Pipe

screenshot from 2013-08-17 23 58 31

However on a later line when when I try to auto-complete Pipe, it shows nothing:

screenshot from 2013-08-17 23 56 55

I understand that errors like this may be hard to duplicate. So I am not how to give you enough information to debug this.

I tried one of two other modules that should be supplied by Async.Std (such as Udp). Even they don't seem to be auto-completing. Doing merlin-rewind also does not seem to help.

Update: Modules from Core.Std do seem to auto complete.

screenshot from 2013-08-18 00 04 07

And fully qualifying Async.Std.Pipe also seems to work.

screenshot from 2013-08-18 00 04 32

Update: I have filed Issue #77 about the the problem documented in this comment.

roshanjames commented 11 years ago

Here is another example of no auto-complete:

screenshot

The module Snapshot is defined further up in the same file. Snapshot does have errors in it according to merlin, but these should not prevent merlin from showing some ac information. Here are the error locations:

screenshot-1

That said, it is surprising that it does not seem to be understanding with sexp and bin_io. The error at that point says "Unbound type constructor t".

trefis commented 11 years ago

@roshanjames Any news?

roshanjames commented 11 years ago

Ok, this is exciting. I'll get back to you guys later today once I have had the chance to look at things.

On Sep 5, 2013, at 4:44 AM, Thomas Refis notifications@github.com wrote:

@roshanjames Any news?

— Reply to this email directly or view it on GitHub.