ocaml / merlin

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

Flag to include current directory #59

Closed roshanjames closed 11 years ago

roshanjames commented 11 years ago

Often one wants to refer to ml and mli files from the current directory. Instead of always adding the current directory to the .merlin file, add a flag to merlin such that the current directory is included as a source directory.

let-def commented 11 years ago

This feature has been added to master, though it may need some fix.

roshanjames commented 11 years ago

Nice. I have a local build of merlin going now -- I'll update and try it out. Is this enabled by default in the emacs mode?

let-def commented 11 years ago

I can't tell anything about emacs support, though it should work out-of-the-box I think. I coded it quickly as a PoC, I will take more time to test it this we.

roshanjames commented 11 years ago

In this regard, I have a loose suggestion: if you have features that can be enabled via a command line flag to merlin, there should be an obvious mapping between the command line flag to merlin and what one needs to do to enable it via emacs. Maybe this is as simple as having an emacs mode variable called "merlin-command-line-flags". That way there isnt always an this issue of updating the emacs mode to toggle some command line flags to merlin.

asmanur commented 11 years ago

It is already implemented in master since 1.2 I believe.

Use M-x merlin-process-add-flag yourflag, and then restart the process with C-c r (or merlin-restart-process).

@def-lkb, could you update the variable merlin--flags that holds the list of possible flags in merlin.el when you add a flag ? (or ping me)

There is no mechanism for default flags though setting merlin--current-flags might do the job for the moment.

On jeu. 15/août 2013 (17:13), Roshan James wrote:

In this regard, I have a loose suggestion: if you have features that can be enabled via a command line flag to merlin, there should be an obvious mapping between the command line flag to merlin and what one needs to do to enable it via emacs. Maybe this is as simple as having an emacs mode variable called "merlin-command-line-flags". That way there isnt always an this issue of updating the emacs mode to toggle some command line flags to merlin.


Reply to this email directly or view it on GitHub: https://github.com/def-lkb/merlin/issues/59#issuecomment-22740025

roshanjames commented 11 years ago

I tried to verify if merlin will auto-complete from .ml files in the current directory. It does not seem to work. I am at revision fef38bdf.

In the directory I have three files called a.ml, b.ml and f.ml. When editing f.ml I type A.{M-/} and I see nothing. Note that the file a.ml is not compiled yet. b.ml is compiled and has a b.cmi. When I type B.{M-/} it does autocomplete.

In the common case, such as when working on a library, there might be many .ml files in a dir which maynot be compiling as yet. They may not have .cmi files. However it would be nice to generate auto-completion for them.

I tried to force the parsing of source files by creating the following .merlin file in the dir:

SRC . REC

This seemed to have no effect -- i.e. A.{M-/} still did not auto-complete. I restarted the merlin process.

let-def commented 11 years ago

Now that experimental has been merged in master branch, this bug should be fixed. Can you confirm?