Fix .merlin generation: add all workspaces projects to merlin's source path

(otherwise "locate" doesn't work)
This commit is contained in:
Thomas Refis 2017-05-29 13:19:21 +01:00
parent df3ac59d72
commit b52d778d4c
2 changed files with 14 additions and 7 deletions

View File

@ -12,6 +12,9 @@
- Fix a race condition in future.ml causing jbuilder to crash on
Windows in some cases (#101)
- Fix .merlin generation: projects in the same workspace are added to
merlin's source path, so "locate" works on them.
1.0+beta9 (19/05/2017)
----------------------

View File

@ -40,12 +40,18 @@ let dot_merlin sctx ~dir ({ requires; flags; _ } as t) =
>>^ (fun libs ->
let ppx_flags = ppx_flags sctx ~dir ~src_dir:remaindir t in
let internals, externals =
List.partition_map libs ~f:(function
List.fold_left libs ~init:([], []) ~f:(fun (internals, externals) ->
function
| Lib.Internal (path, _) ->
let path = Path.reach path ~from:remaindir in
Inl ("B " ^ path)
let spath =
Path.drop_build_context path
|> Path.reach ~from:remaindir
in
let bpath = Path.reach path ~from:remaindir in
("S " ^ spath) :: ("B " ^ bpath) :: internals, externals
| Lib.External pkg ->
Inr ("PKG " ^ pkg.name))
internals, ("PKG " ^ pkg.name) :: externals
)
in
let flags =
match flags with
@ -54,9 +60,7 @@ let dot_merlin sctx ~dir ({ requires; flags; _ } as t) =
in
let dot_merlin =
List.concat
[ [ "S ."
; "B " ^ (Path.reach dir ~from:remaindir)
]
[ [ "B " ^ (Path.reach dir ~from:remaindir) ]
; internals
; externals
; flags