[ANN] ocaml-lsp-server 1.3.0

On behalf of the ocaml-lsp team, I’d like to announce version 1.3.0.

This release an improvement in keyword completion and a new code action. Keywords are now filtered by the context the user requested the completion, and there’s a new code action to quickly populate .mli files with the the inferred types from the .ml file.


Thanks for the good work. Is there a plan to implement the possibility to see the type of an expression (as it exists in Emacs/Merlin for instance)? And be able to select an enclosing expression (of a first one) to see its type?

Another great feature would be to rename an identifier, restricted to its scope (Ctrl-F2 with a syntactivally-correct scope, not the whole file)?

I think that is what textDocument/hover does. Or you are thinking of something different?

The rename feature does an edition which is semantically correct (most of the time). That would be broken by a limitation of the scope?

If you mean hovering with the mouse: in Codium 1.51, it only works on an identifier. When I was using Emacs/Merlin, it worked on any “correct” expression. Here, I don’t know how to do this?

Sorry, I typed Ctrl-F2 instead of simple F2. It’s good then.

I don’t think the protocol supports such a query unfortunately. The protocol is still evolving, so perhaps there will be support in future versions

Also you can actually get types not only on an identifier. In {foo; bar} if you hover on the curly braces or the space, you will get the type of the record. So it’s not the most practical thing ever, but if you can surround an expression that you want to type with parentheses, then you can get the type of this expression.

Didn’t know, that, cool tip, thanks. In principle, I guess an extension adding “virtual” parentheses to infer the type of a complex expression could be implemented in the VS Code/Codium extension, rather than in ocaml-lsp then… Easier said than done, sure.