Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(merlin): tolerate files without extension #11128

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/changes/11128.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Tolerate files without extension when generating merlin rules.
(#11128, @anmonteiro)
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
Loading