-
Notifications
You must be signed in to change notification settings - Fork 117
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: refresh merlin configs after dune build #853
fix: refresh merlin configs after dune build #853
Conversation
It seems like we're "set"ting the new diagnostics for merlin docs but don't send them? If I add That's very cool! I was thinking of this feature, but I imagined we need to update diagnostics only for reverse deps of the module that's being edited, but your solution seems good. |
15233f9
to
f02c3f4
Compare
Thanks. This is now fixed.
It turns this is problematic to implement with dune currently. One needs to keep a set of the dependency closure for every module and keep it updated. It's not trivial but if this solution isn't good enough, we'll have to go this way. |
ps-id: 0f3e313d-219b-4dcc-bcb5-0a2c6937e1f1
f02c3f4
to
6116f0e
Compare
If the file being edited is an implementation file and given its interface file exists, would it make sense that we only update diagnostics for its interface file if it's open? But if the impl file being edited doesn't have an interface file, then we update diagnostics to all files. |
I'm not sure I understand the optimization. Can you give an example? |
I meant to say that, to my understanding, OCaml can avoid compiling reverse dependencies of a compilation unit, if the unit's interface hasn't changed. Consequently, if we could determine that the re-build was triggered by edits to an implementation file, we could only update diagnostics for its interface file and not for other files, which would not anyway have any changes in their diagnostics from merlin because they depend on the unchanged interface file. For example, if there's It's not clear, however, how to determine whether the re-build was triggered by changes to an implementation file. We could
Does this help? |
Okay, I understand. Note that we don't need to worry about any of these details since they're all reflected in the dependency graph dune provides us with. We just need a better way to work with it. |
CHANGES: ## Features - Code action for inlining let bindings within a module or expression. (ocaml/ocaml-lsp#847) - Tag "unused code" and "deprecated" warnings, allowing clients to better display them. (ocaml/ocaml-lsp#848) - Refresh merlin configuration after every dune build in watch mode (ocaml/ocaml-lsp#853) ## Fixes - Respect `showDocument` capabilities. Do not offer commands or code actions that rely on this request without client support. (ocaml/ocaml-lsp#836) - Fix signatureHelp on .mll files: avoid "Document.dune" exceptions
When dune finishes a build, merlin configuration might not be correct and it's useful to reload it and give users fresh diagnostics. Of course, this requires us throwing away some diagnostic work that isn't necessarily stale, but it's better to be slow than give false positives to the user.