Skip to content

Commit

Permalink
[B] ocaml#1839 Fix ignorance of SOURCE_ROOT directive
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Sep 25, 2024
1 parent c5d64af commit 47a30a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/dot-merlin/dot_merlin_reader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ let postprocess cfg =
cfg.stdlib
|> Option.map ~f:(fun stdlib -> `STDLIB stdlib)
|> Option.to_list;
cfg.source_root
|> Option.map ~f:(fun source_root -> `SOURCE_ROOT source_root)
|> Option.to_list;
List.concat_map pkg_paths ~f:(fun p -> [ `B p; `S p ]);
ppx;
List.map failures ~f:(fun s -> `ERROR_MSG s)
Expand Down
5 changes: 3 additions & 2 deletions tests/test-dirs/config/dot-merlin-reader/load-config.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ This test comes from: https://github.com/janestreet/merlin-jst/pull/59
> BH build-hidden/dir
> SH source-hidden/dir
> STDLIB /stdlib
> SOURCE_ROOT /root
> EOF

$ FILE=$(pwd)/test.ml; dot-merlin-reader <<EOF | sed 's#[0-9]*:#?:#g'
> (4:File${#FILE}:$FILE)
> EOF
((?:B?:$TESTCASE_ROOT/build/dir)(?:S?:$TESTCASE_ROOT/source/dir)(?:ERROR?:Unknown tag in .merlin?: BH)(?:ERROR?:Unknown tag in .merlin?: SH)(?:STDLIB?:/stdlib))
((?:B?:$TESTCASE_ROOT/build/dir)(?:S?:$TESTCASE_ROOT/source/dir)(?:ERROR?:Unknown tag in .merlin?: BH)(?:ERROR?:Unknown tag in .merlin?: SH)(?:STDLIB?:/stdlib)(?:SOURCE_ROOT?:/root))

$ echo | $MERLIN single dump-configuration -filename test.ml 2> /dev/null | jq '.value.merlin'
{
Expand All @@ -36,7 +37,7 @@ This test comes from: https://github.com/janestreet/merlin-jst/pull/59
}
],
"stdlib": "/stdlib",
"source_root": null,
"source_root": "/root",
"unit_name": null,
"wrapping_prefix": null,
"reader": [],
Expand Down

0 comments on commit 47a30a4

Please sign in to comment.