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: jump to def/decl/type-def don't stop working after the first jump #901

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 16 additions & 1 deletion ocaml-lsp-server/src/ocaml_lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,22 @@ let on_request :
| TextDocumentDeclaration { textDocument = { uri }; position } ->
later (fun state () -> definition_query `Declaration state uri position) ()
| TextDocumentDefinition { textDocument = { uri }; position; _ } ->
later (fun state () -> definition_query `Definition state uri position) ()
let doc =
Document_store.change_document store uri ~f:(fun doc ->
(* we need [update_text] with no changes to get a new merlin pipeline;
otherwise the diagnostics don't get updated *)
Document.update_text doc [])
in
let+ (), state =
Fiber.fork_and_join
(fun (* TODO: should we really be updating the diagnostics here? *)
() -> set_diagnostics state.detached state.diagnostics doc)
(fun () ->
later
(fun state () -> definition_query `Definition state uri position)
())
in
state
| TextDocumentTypeDefinition { textDocument = { uri }; position; _ } ->
later
(fun state () -> definition_query `Type_definition state uri position)
Expand Down