-
Notifications
You must be signed in to change notification settings - Fork 358
Changelog: Announce ocaml-eglot #3080
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
base: main
Are you sure you want to change the base?
Conversation
I think that Eglot worked with OCaml ever before, but Are there really plans to sunset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sabine!
|
||
## TL;DR | ||
|
||
`ocaml-eglot` provides full OCaml language support in Emacs through the Language Server Protocol (LSP) instead of direct Merlin integration. It offers the same features as `merlin.el` with simplified setup and enhanced capabilities like project-wide search. If you're starting fresh or want a more standardized approach, try `ocaml-eglot`. If your current `merlin.el` setup works well, you can continue using it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though the statement about merlin.el
is generally true, I think it is important to mention that the evolution of ocaml-eglot
is more sustainable because it is maintained, which is not really the case with merlin.el
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also worth mentioning that ocaml-eglot
is a minor mode. It therefore works in conjunction with a major mode to edit Caml code. Examples of major modes include tuareg
, caml-mode
and the recent neocaml
.
|
||
## What is ocaml-eglot? | ||
|
||
`ocaml-eglot` connects Emacs to `ocaml-lsp-server` using the Language Server Protocol, providing a standardized way to get OCaml language support. This eliminates editor-specific integrations while preserving all OCaml-specific features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is worth mentioning that since the recent versions of Emacs (29
), Eglot
, an lsp
client, has been shipped with Emacs. It is therefore reasonable to use ocaml-lsp-server
to provide IDE services (standardising the experience for users of multiple languages). However, LSP is designed to be generic, so relying solely on the features of LSP and Eglot limits functionality and offers fewer features than merlin.el
. That is why the server has been extended to support more features, and ocaml-eglot
allows you to benefit from these features in Emacs, in conjunction with eglot
.
- Your current setup is working perfectly and heavily customized | ||
- You prefer direct Merlin communication | ||
|
||
Both approaches are fully supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure what ‘fully supported’ means in this context. I think we can say that, for the moment, we don't plan to provide any special support for merlin.el unless we receive a lot of requests.
## Getting Started | ||
|
||
### Prerequisites | ||
- Emacs 29.1+ (includes Eglot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user is using an earlier version, Eglot can still be installed.
- Emacs 29.1+ (includes Eglot) | ||
- `opam install ocaml-lsp-server ocamlformat` | ||
|
||
### Basic Setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we want to list the installation procedures in the changelog when they are already well documented in the README (and this potentially means maintaining the procedure in two different places)?
## Essential Commands | ||
|
||
| Feature | Command | Key Binding | | ||
|---------|---------|-------------| | ||
| Show type | `ocaml-eglot-type-enclosing` | `C-c C-t` | | ||
| Jump to definition | `ocaml-eglot-find-definition` | `C-c C-l` | | ||
| Jump to declaration | `ocaml-eglot-find-declaration` | `C-c C-i` | | ||
| Generate patterns | `ocaml-eglot-destruct` | `C-c \|` | | ||
| Fill holes | `ocaml-eglot-construct` | `C-c \` | | ||
| Switch .ml/.mli | `ocaml-eglot-alternate-file` | `C-c C-a` | | ||
| Show documentation | `ocaml-eglot-document` | `C-c C-d` | | ||
| Search by type | `ocaml-eglot-search` | | | ||
| Rename symbol | `ocaml-eglot-rename` | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can point to the README for a detailed list of features, right?
# Then use ocaml-eglot-rename in Emacs | ||
``` | ||
|
||
**Polarity search**: Find functions by input/output types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is also available in merlin.el
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And I think that search by types is better, search by polarity is historically present).
TODO:
Resolves https://github.com/tarides/squad-adex/issues/40