Skip to content

Commit

Permalink
Merge pull request #1839 from liam923/fix-source-root
Browse files Browse the repository at this point in the history
Fix ignorance of SOURCE_ROOT directive
  • Loading branch information
voodoos authored Sep 25, 2024
2 parents 80e919c + 5bd4b44 commit 04b59dc
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 @@ -426,6 +426,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)(?:BH?:$TESTCASE_ROOT/build-hidden/dir)(?:SH?:$TESTCASE_ROOT/source-hidden/dir)(?:STDLIB?:/stdlib))
((?:B?:$TESTCASE_ROOT/build/dir)(?:S?:$TESTCASE_ROOT/source/dir)(?:BH?:$TESTCASE_ROOT/build-hidden/dir)(?:SH?:$TESTCASE_ROOT/source-hidden/dir)(?:STDLIB?:/stdlib)(?:SOURCE_ROOT?:/root))

$ echo | $MERLIN single dump-configuration -filename test.ml 2> /dev/null | jq '.value.merlin'
{
Expand Down Expand Up @@ -43,7 +44,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 04b59dc

Please sign in to comment.