go-to-definition is broken
I tried it with a minmal example, the lens works but the go-to-definition breaks (non-terminating)
My version is 4.10.2 on M1, the plugin is the latest
)
The latest version of the lsp server only works with 4.12. Are you sure that's what you're using?
I switched to 4.12 and upgraded lsp to 1.8.3 the basic go-to-definition still does not work. (It also reminds me that ocamlformat_rpc is missing) What is your working version?
I tried your example and it seems to work. Going to the definition of List.length works fine. So is going to the definition of f when I jump to it from some other identifier. Do you see any errors in the output pane perhaps?
It gets stuck there
go-to-declaration actually works, but go-to-definition gets stuck forever
tried this for f, go-to-definition does not work for local buffers either

Could you paste a backtrace for me if you don't mind? E.g. lldb -n ocamllsp -o "bt all"
(lldb) process attach --name "ocamllsp"
Process 36506 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x000000019ef5c5c8 libsystem_kernel.dylib`__psynch_cvwait + 8
libsystem_kernel.dylib`__psynch_cvwait:
-> 0x19ef5c5c8 <+8>: b.lo 0x19ef5c5e8 ; <+40>
0x19ef5c5cc <+12>: pacibsp
0x19ef5c5d0 <+16>: stp x29, x30, [sp, #-0x10]!
0x19ef5c5d4 <+20>: mov x29, sp
Target 0: (ocamllsp) stopped.
Executable module set to "/Users/zhanghongbo/.opam/4.12.0/bin/ocamllsp".
Architecture set to: arm64e-apple-macosx-.
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000019ef5c5c8 libsystem_kernel.dylib`__psynch_cvwait + 8
frame #1: 0x000000019ef93508 libsystem_pthread.dylib`_pthread_cond_wait + 1248
frame #2: 0x000000010287f740 ocamllsp`caml_condition_wait [inlined] st_condvar_wait(c=0x0000000135e08840, m=0x0000000135e08870) at st_posix.h:290:10 [opt]
frame #3: 0x000000010287f734 ocamllsp`caml_condition_wait(wcond=<unavailable>, wmut=<unavailable>) at st_stubs.c:869 [opt]
frame #4: 0x00000001028ad460 ocamllsp`caml_c_call + 28
frame #5: 0x00000001027b5038 ocamllsp`camlFiber_unix__Channel__aux_525 + 144
frame #6: 0x00000001027b43fc ocamllsp`camlFiber_unix__Import__code_begin + 44
frame #7: 0x00000001027b62dc ocamllsp`camlFiber_unix__Scheduler__event_next_1730 + 20
frame #8: 0x00000001027ebee4 ocamllsp`camlFiber__fun_5408 + 28
frame #9: 0x0000000102499af0 ocamllsp`caml_apply2 + 56
frame #10: 0x00000001027e6570 ocamllsp`camlFiber__loop_553 + 64
frame #11: 0x00000001027fd740 ocamllsp`camlStdune__Exn__code_begin + 40
frame #12: 0x00000001027b7a90 ocamllsp`camlFiber_unix__Scheduler__run_result_2324 + 216
frame #13: 0x00000001027b7bf4 ocamllsp`camlFiber_unix__Scheduler__run_2337 + 12
frame #14: 0x00000001028260a8 ocamllsp`camlCmdliner_term__fun_182 + 112
frame #15: 0x000000010282921c ocamllsp`camlCmdliner__run_414 + 44
frame #16: 0x0000000102829550 ocamllsp`camlCmdliner__term_eval_440 + 288
frame #17: 0x0000000102829d84 ocamllsp`camlCmdliner__eval_825 + 300
frame #18: 0x0000000102499c88 ocamllsp`camlDune__exe__Main__entry + 288
frame #19: 0x00000001024936ac ocamllsp`caml_program + 8700
frame #20: 0x00000001028ad4d8 ocamllsp`caml_start_program + 108
frame #21: 0x0000000102887db8 ocamllsp`caml_startup_common(argv=0x00000001027b5038, pooling=<unavailable>) at startup_nat.c:158:10 [opt]
frame #22: 0x0000000102887e20 ocamllsp`caml_main [inlined] caml_startup_exn(argv=<unavailable>) at startup_nat.c:163:10 [opt]
frame #23: 0x0000000102887e18 ocamllsp`caml_main [inlined] caml_startup(argv=<unavailable>) at startup_nat.c:168 [opt]
frame #24: 0x0000000102887e18 ocamllsp`caml_main(argv=<unavailable>) at startup_nat.c:175 [opt]
frame #25: 0x0000000102887e80 ocamllsp`main(argc=<unavailable>, argv=<unavailable>) at main.c:41:3 [opt]
frame #26: 0x000000019efb0420 libdyld.dylib`start + 4
thread #2
frame #0: 0x000000019ef5c3c4 libsystem_kernel.dylib`__semwait_signal + 8
frame #1: 0x000000019eed82a4 libsystem_c.dylib`nanosleep + 216
frame #2: 0x0000000102884890 ocamllsp`unix_sleep(duration=<unavailable>) at sleep.c:42:13 [opt]
frame #3: 0x00000001028ad460 ocamllsp`caml_c_call + 28
frame #4: 0x00000001027b5464 ocamllsp`camlFiber_unix__Scheduler__time_loop_1286 + 180
frame #5: 0x00000001027e3174 ocamllsp`camlThread__fun_314 + 44
frame #6: 0x00000001028ad4d8 ocamllsp`caml_start_program + 108
frame #7: 0x00000001028a1fb8 ocamllsp`caml_callback_exn(closure=<unavailable>, arg=1) at callback.c:111:10 [opt]
frame #8: 0x000000010287ec1c ocamllsp`caml_thread_start(arg=<unavailable>) at st_stubs.c:538:5 [opt]
frame #9: 0x000000019ef92fd4 libsystem_pthread.dylib`_pthread_start + 320
thread #3
frame #0: 0x000000019ef631fc libsystem_kernel.dylib`__select + 8
frame #1: 0x000000010287ec8c ocamllsp`caml_thread_tick(arg=<unavailable>) at st_posix.h:388:5 [opt]
frame #2: 0x000000019ef92fd4 libsystem_pthread.dylib`_pthread_start + 320
thread #4
frame #0: 0x000000019ef59a3c libsystem_kernel.dylib`read + 8
frame #1: 0x00000001028a164c ocamllsp`caml_read_fd(fd=<unavailable>, flags=<unavailable>, buf=<unavailable>, n=65536) at unix.c:78:13 [opt]
frame #2: 0x0000000102896b54 ocamllsp`caml_input_scan_line(channel=0x0000000138410000) at io.c:407:11 [opt]
frame #3: 0x0000000102897e38 ocamllsp`caml_ml_input_scan_line(vchannel=<unavailable>) at io.c:848:9 [opt]
frame #4: 0x00000001028ad460 ocamllsp`caml_c_call + 28
frame #5: 0x000000010282ce84 ocamllsp`camlStdlib__scan_329 + 36
frame #6: 0x00000001027aa83c ocamllsp`camlLsp__Header__loop_420 + 28
frame #7: 0x00000001027aa758 ocamllsp`camlLsp__Header__read_417 + 88
frame #8: 0x00000001027aada0 ocamllsp`camlLsp__Io__read_content_504 + 32
frame #9: 0x00000001027aaf08 ocamllsp`camlLsp__Io__read_598 + 16
frame #10: 0x00000001027aaf34 ocamllsp`camlLsp__Io__read_1233 + 12
frame #11: 0x0000000102718d50 ocamllsp`camlLsp_fiber__Fiber_io__fun_1576 + 24
frame #12: 0x000000010280c888 ocamllsp`camlStdune__Exn_with_backtrace__try_with_223 + 40
frame #13: 0x00000001027b57e8 ocamllsp`camlFiber_unix__Scheduler__do_no_raise_1410 + 24
frame #14: 0x00000001027b51f4 ocamllsp`camlFiber_unix__Channel__code_end + 60
frame #15: 0x00000001027e3174 ocamllsp`camlThread__fun_314 + 44
frame #16: 0x00000001028ad4d8 ocamllsp`caml_start_program + 108
frame #17: 0x00000001028a1fb8 ocamllsp`caml_callback_exn(closure=<unavailable>, arg=1) at callback.c:111:10 [opt]
frame #18: 0x000000010287ec1c ocamllsp`caml_thread_start(arg=<unavailable>) at st_stubs.c:538:5 [opt]
frame #19: 0x000000019ef92fd4 libsystem_pthread.dylib`_pthread_start + 320
thread #5
frame #0: 0x000000019ef5c5c8 libsystem_kernel.dylib`__psynch_cvwait + 8
frame #1: 0x000000019ef93508 libsystem_pthread.dylib`_pthread_cond_wait + 1248
frame #2: 0x000000010287f740 ocamllsp`caml_condition_wait [inlined] st_condvar_wait(c=0x0000000135e08b80, m=0x0000000135e08bb0) at st_posix.h:290:10 [opt]
frame #3: 0x000000010287f734 ocamllsp`caml_condition_wait(wcond=<unavailable>, wmut=<unavailable>) at st_stubs.c:869 [opt]
frame #4: 0x00000001028ad460 ocamllsp`caml_c_call + 28
frame #5: 0x00000001027b5038 ocamllsp`camlFiber_unix__Channel__aux_525 + 144
frame #6: 0x00000001027b43fc ocamllsp`camlFiber_unix__Import__code_begin + 44
frame #7: 0x00000001027b51cc ocamllsp`camlFiber_unix__Channel__code_end + 20
frame #8: 0x00000001027e3174 ocamllsp`camlThread__fun_314 + 44
frame #9: 0x00000001028ad4d8 ocamllsp`caml_start_program + 108
frame #10: 0x00000001028a1fb8 ocamllsp`caml_callback_exn(closure=<unavailable>, arg=1) at callback.c:111:10 [opt]
frame #11: 0x000000010287ec1c ocamllsp`caml_thread_start(arg=<unavailable>) at st_stubs.c:538:5 [opt]
frame #12: 0x000000019ef92fd4 libsystem_pthread.dylib`_pthread_start + 320
thread #6
frame #0: 0x000000019ef5c5c8 libsystem_kernel.dylib`__psynch_cvwait + 8
frame #1: 0x000000019ef93508 libsystem_pthread.dylib`_pthread_cond_wait + 1248
frame #2: 0x000000010287f740 ocamllsp`caml_condition_wait [inlined] st_condvar_wait(c=0x0000000135e08d20, m=0x0000000135e08d50) at st_posix.h:290:10 [opt]
frame #3: 0x000000010287f734 ocamllsp`caml_condition_wait(wcond=<unavailable>, wmut=<unavailable>) at st_stubs.c:869 [opt]
frame #4: 0x00000001028ad460 ocamllsp`caml_c_call + 28
frame #5: 0x00000001027b5038 ocamllsp`camlFiber_unix__Channel__aux_525 + 144
frame #6: 0x00000001027b43fc ocamllsp`camlFiber_unix__Import__code_begin + 44
frame #7: 0x00000001027b51cc ocamllsp`camlFiber_unix__Channel__code_end + 20
frame #8: 0x00000001027e3174 ocamllsp`camlThread__fun_314 + 44
frame #9: 0x00000001028ad4d8 ocamllsp`caml_start_program + 108
frame #10: 0x00000001028a1fb8 ocamllsp`caml_callback_exn(closure=<unavailable>, arg=1) at callback.c:111:10 [opt]
frame #11: 0x000000010287ec1c ocamllsp`caml_thread_start(arg=<unavailable>) at st_stubs.c:538:5 [opt]
frame #12: 0x000000019ef92fd4 libsystem_pthread.dylib`_pthread_start + 320
Well that's unfortunate, there's no easy infinite loop to fix. One last thing, could you post your dune file?
The dune file is very simple, it is generated by dune init lib hello.
Anyway that I can have more logs & diganostics?
btw you don't seem to use OCaml Platform, is this why this doesn't work? My go-to definition stopped working today and I fixed it by manually choosing my switch there:

@mimoo I tried several global switches today, none of them worked
@rgrinberg the pic shows the loading forever, any way I can get some more detailed logs to help diagnose?
Please see the vscode-ocaml-platform GitHub page for more information on debugging and reporting problems
On Thu, 4 Nov 2021 at 14:34, Hongbo Zhang @.***> wrote:
[image: Screen Shot 2021-11-04 at 9 33 06 PM] https://user-images.githubusercontent.com/747051/140322428-6050e7bd-23aa-4600-8c32-27138ecfd936.png
@rgrinberg https://github.com/rgrinberg the pic shows the loading forever, any way I can get some more detailed logs to help diagnose?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ocaml/ocaml-lsp/issues/520#issuecomment-960939976, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4YR65OGUAJ4D7EGDVVQWLUKKDWHANCNFSM5F4NLWBA .
Shapes should have fixed this.