Skip to content

Commit

Permalink
fix(merlin): tolerate files without extension
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
  • Loading branch information
anmonteiro committed Nov 17, 2024
1 parent c6a0a69 commit 45959f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dune_rules/merlin/merlin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ open Memo.O

let remove_extension file =
let dir = Path.Build.parent_exn file in
let basename, _ext = String.lsplit2_exn (Path.Build.basename file) ~on:'.' in
let basename =
let basename = Path.Build.basename file in
match String.lsplit2 basename ~on:'.' with
| Some (basename, _ext) -> basename
| None -> basename
in
Path.Build.relative dir basename
;;

Expand Down

0 comments on commit 45959f3

Please sign in to comment.