hackwaly / ocamlearlybird

OCaml debug adapter
MIT License
208 stars 23 forks source link

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

Closed victorvianna closed 1 year ago

victorvianna commented 4 years ago

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.

EduardoRFS commented 3 years ago

@victorvianna did you had any progress here?

ialak commented 3 years ago

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

vthemelis commented 1 year ago

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?

vthemelis commented 1 year ago

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.

sim642 commented 1 year ago

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

Zeta611 commented 1 year ago

@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.

sim642 commented 1 year ago

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 https://github.com/ocamllabs/vscode-ocaml-platform/pull/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.