-
Notifications
You must be signed in to change notification settings - Fork 121
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
feature: disable code lens by default #1134
Conversation
56838b1
to
c7f6ed8
Compare
Update the config.md ocaml-lsp/ocaml-lsp-server/docs/ocamllsp/config.md Lines 14 to 20 in 16c2d41
|
This feature seems to annoy quite a few users so we disable it by default. It can be enabled through configuration. Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 4dd3b3fc-5f88-48df-b6a9-8792dde164b4 -->
c7f6ed8
to
772062a
Compare
Pull Request Test Coverage Report for Build 3852Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
CHANGES: ## Fixes - Disable code lens by default. The support can be re-enabled by explicitly setting it in the configuration. (ocaml/ocaml-lsp#1134) - Fix initilization of `ocamlformat-rpc` in some edge cases when ocamlformat is initialized concurrently (ocaml/ocaml-lsp#1132) - Kill unnecessary `$ dune ocaml-merlin` with SIGTERM rather than SIGKILL (ocaml/ocaml-lsp#1124) - Refactor comment parsing to use `odoc-parser` and `cmarkit` instead of `octavius` and `omd` (ocaml/ocaml-lsp#1088) This allows users who migrated to omd 2.X to install ocaml-lsp-server in the same opam switch. We also slightly improved markdown generation support and fixed a couple in the generation of inline heading and module types. - Allow opening documents that were already open. This is a workaround for neovim's lsp client (ocaml/ocaml-lsp#1067) - Disable type annotation for functions (ocaml/ocaml-lsp#1054) - Respect codeActionLiteralSupport capability (ocaml/ocaml-lsp#1046) - Fix a document syncing issue when utf-16 is the position encoding (ocaml/ocaml-lsp#1004) - Disable "Type-annotate" action for code that is already annotated. ([ocaml/ocaml-lsp#1037](ocaml/ocaml-lsp#1037)), fixes [ocaml/ocaml-lsp#1036](ocaml/ocaml-lsp#1036) - Fix semantic highlighting of long identifiers when using preprocessors ([ocaml/ocaml-lsp#1049](ocaml/ocaml-lsp#1049), fixes [ocaml/ocaml-lsp#1034](ocaml/ocaml-lsp#1034)) - Fix the type of DocumentSelector in cram document registration (ocaml/ocaml-lsp#1068) - Accept the `--clientProcessId` command line argument. (ocaml/ocaml-lsp#1074) - Accept `--port` as a synonym for `--socket`. (ocaml/ocaml-lsp#1075) - Fix connecting to dune rpc on Windows. (ocaml/ocaml-lsp#1080) ## Features - Add "Remove type annotation" code action. (ocaml/ocaml-lsp#1039) - Support settings through `didChangeConfiguration` notification (ocaml/ocaml-lsp#1103) - Add "Extract local" and "Extract function" code actions. (ocaml/ocaml-lsp#870) - Depend directly on `merlin-lib` 4.9 (ocaml/ocaml-lsp#1070)
FWIW, this is a terrible user experience for anyone not very comfortable with their editor and the ocaml environment. This is definitely something that is expected to work by default. And the fix is completely non obvious. |
It's the first time I've heard of this being an issue, what problem were they seeing with code lense enabled by default?
Default is king, this mean most user will assume ocaml tooling doesn't support code lens because they'll won't be aware of the config switch, or how to configure their particular flavor of editor/lsp-plugin to have that switch forwarded to ocaml-lsp. |
I have approved this PR because it was technically correct, but considering above arguments I'd say that we should bring back default code lenses. |
There's just as many users who complained about this feature to me personally as there are people in here that are in favor of it. There can only be one default so unfortunately, we will need to upset one group. I suggest that we play it conservatively with controversial features and disable them by default. If we didn't make it easy enough to re-enable this feature, that's a very valid complaint. As a side note, @jfeser is adding inlay hints which are going to be strictly superior to this feature anyway and we'll definitely enable that by default. |
It would be nice to move these complains to the issue tracker, so there's an opportunity to have a discussion. What is the reason they are annoyed by the feature? |
The complaint is fairly simple: they take up a lot of vertical real estate and provide little value. The problem is compounded when other plugins want to provide code lenses. They aren't actionable, so they don't even fulfill their original spec. @ddickstein @hackwaly @aspeddro can expand as well. These are just the names I remember who complained about this feature. |
Thanks!
My opinion on this is that when choosing which defaults to use, we should prioritise new users since users who are advanced enough to know what they want are able to configure their editors to match that. That's also the opinion of @Khady above IIUC.
|
I would accept that given an config option to disable it rather than make disable as default. Since newcomes may not know if there is codelens for types |
Okay, you guys can bring it back if you want. Heads up, it's still going away in favor of inlay hints as those are designed for type annotations unlike the code lens. |
Will the inlay hints provide type annotations for top-level values/functions? It does seem to be the case in the screenshot on #1159. If it does, then the information is duplicated and I would agree that code lens can be replaced with inlay hints, otherwise it seems useful to have both |
Yes, they will work for top-level functions and values. Although they are not that intrusive so we can enable them everywhere. |
Ok, if the information is duplicated, then I'm siding with you and I don't think it's useful to bring the code lens back (as the default). Would be nice to introduce the inlay hints at the same time as the removal of code lens (as the default) so we don't have a release with neither. |
Indeed it looks like inlay hints will be the way to good, thanks for the information. |
Some context on why I raised this with @rgrinberg originally:
|
Sure I'm happy to replace the codelens with inlay when the latter lands. But in the meantime a useful feature was (relatively silently) dropped with no replacement and no quickfix but forking ocamllsp. Maybe for such breaking changes if there isn't a good support in all major editors ocamllsp should provide a workaround. It could be a CLI argument to the ocamllsp binary or an environment variable for example.
the name of the config option to disable the codelens is probably too generic then? As one might want to disable the type codelens but keep the other kind of codelens? |
Big 👍 on this being a poor change, absent an obvious alternative. I was sure either the vscode extension or ocamllsp were borked (as I've always used the presence of the codelenses as the primary indication that the extension and lsp server were talking properly), and was about to write up something equivalent to #1164 before I thankfully saw it waiting for me. (I'm also far from sold on "inlays" as being obviously superior based on what I see in #1159, but perhaps that's a separate topic.) Could someone please ELI5 how to restore the codelens functionality? Getting hints from trawling through various issues and commits, I've tried these configuration, with no results:
|
@cemerick, the config is |
For anyone coming here looking for the solution for neovim, if you are using lsp-config, you will need to add to your ocamllsp setup something like: require('lspconfig').ocamllsp.setup {
settings = {
codelens = { enable = true },
},
} |
So, this was disabled by default, there is a bug which makes it not enabled in VSCode for a while and inlay hints hasn't been merged yet. Can we enable it by default again? |
This feature seems to annoy quite a few users so we disable it by
default. It can be enabled through configuration.
Signed-off-by: Rudi Grinberg [email protected]