hackwaly / ocamlearlybird

OCaml debug adapter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`(lang dune 2.x)` won't hit breakpoints

victorvianna opened this issue · comments

After quite some investigation, I've tracked down the reason my vscode wouldn't stop on breakpoints. If your dune-project file uses (lang dune $VERSION) where VERSION >= 2.0, it won't work, and the server won't display any errors.

@victorvianna did you had any progress here?

commented

@EduardoRFS I downgrade dune version to 1.11.4, OCaml version 4.07.1, it works

I'm not hitting any breakpoints either. I tried downgrading the dune language version which didn't help. Downgrading dune is kind of impossible. Does anyone have any insights on this?

I think I found the issue on my side. I had to set

(map_workspace_root false)

to my dune-project file. This was while using version 3.9 of the dune language.

Now I can hit the breakpoints no problem.

I haven't encountered the issue (nor have tried to reproduce it yet), but there's this commit on a fork: tizoc@8afcce8. Maybe that's trying to fix this issue?

@victorvianna Thank you, this saved my day!

I think I found the issue on my side. I had to set

(map_workspace_root false)

to my dune-project file. This was while using version 3.9 of the dune language.

Now I can hit the breakpoints no problem.

According to the docs, the default (map_workspace_root true) breaks the debug info.
This unfortunate situation is explained here.
Perhaps this issue should be more visible or documented somewhere, as people using recent versions of dune will likely encounter this issue.

I added a hint about map_workspace_root to the README: https://github.com/hackwaly/ocamlearlybird#breakpoints-not-hit-with-lang-dune-30-and-above.
Thanks to @vthemelis for suggesting it to be added to ocamllabs/vscode-ocaml-platform#1192 as well.

This fix is for (lang dune 3.0) though, not (lang dune 2.0) like the original issue which I couldn't reproduce. Nevertheless, I'm closing this issue for now. If it's still an issue for 2.x for someone, feel free to reopen/leave a comment.