Skip to content

Commit

Permalink
Do not invoke dune at all if --fallback-read-dot-merlin flag is on
Browse files Browse the repository at this point in the history
  • Loading branch information
SamChou19815 committed Aug 19, 2023
1 parent 0e86a79 commit bfe86da
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions ocaml-lsp-server/src/merlin_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -418,28 +418,30 @@ let config (t : t) : Mconfig.t Fiber.t =
t.entry <- Some entry
in
let* () = Fiber.return () in
match find_project_context t.directory with
| None ->
let+ () = destroy t in
t.initial
| Some (ctx, config_path) ->
let* entry = get_process t.db ~dir:ctx.process_dir in
let* () =
match t.entry with
| None ->
use_entry entry;
Fiber.return ()
| Some entry' ->
if Entry.equal entry entry' then Fiber.return ()
else
let+ () = destroy t in
use_entry entry
in
let+ dot, failures = get_config entry.process ~workdir:ctx.workdir t.path in
if !should_read_dot_merlin then
Fiber.return (Mconfig.get_external_config t.path t.initial)
else
match find_project_context t.directory with
| None ->
let+ () = destroy t in
t.initial
| Some (ctx, config_path) ->
let* entry = get_process t.db ~dir:ctx.process_dir in
let* () =
match t.entry with
| None ->
use_entry entry;
Fiber.return ()
| Some entry' ->
if Entry.equal entry entry' then Fiber.return ()
else
let+ () = destroy t in
use_entry entry
in
let+ dot, failures =
get_config entry.process ~workdir:ctx.workdir t.path
in

if !should_read_dot_merlin && dot = Config.empty then
Mconfig.get_external_config t.path t.initial
else
let merlin = Config.merge dot t.initial.merlin failures config_path in
Mconfig.normalize { t.initial with merlin }

Expand Down

0 comments on commit bfe86da

Please sign in to comment.