Skip to content

Conversation

@Tim-ats-d
Copy link
Contributor

This PR adds an only_toplevel field to CodeLens settings, allowing CodeLens to display only for toplevel let bindings.

Solving #1561

@Tim-ats-d Tim-ats-d force-pushed the configurable-internal-code-lens branch from 008ce82 to a59d7d1 Compare October 22, 2025 12:54
@Tim-ats-d Tim-ats-d force-pushed the configurable-internal-code-lens branch from a59d7d1 to cfe0f89 Compare October 22, 2025 12:58
Copy link
Collaborator

@xvw xvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some e2e-new test to validate the behaviour? Thanks!

@Tim-ats-d Tim-ats-d force-pushed the configurable-internal-code-lens branch from 2b870ff to 0d47e2a Compare October 22, 2025 13:49
Copy link
Collaborator

@xvw xvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last change :) Thanks @Tim-ats-d !

Copy link
Collaborator

@voodoos voodoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be that guy, but I think the choice of option is unnecessary restrictive here. What if one day we add lenses for other things and want to have it finely configurable ? Then with an option named "only_toplevel" we are stuck.

Let's make it additive instead (there might be a better name for it): "for_nested_bindings" with a default to false.

Does that make sense ?

@Tim-ats-d
Copy link
Contributor Author

Sorry to be that guy, but I think the choice of option is unnecessary restrictive here. What if one day we add lenses for other things and want to have it finely configurable ? Then with an option named "only_toplevel" we are stuck.

Let's make it additive instead (there might be a better name for it): "for_nested_bindings" with a default to false.

Does that make sense ?

So you mean the name for the option is not really well-chosen?

@voodoos
Copy link
Collaborator

voodoos commented Oct 23, 2025

(We could also over engineer it with a list: "only: [toplevel_bindings; nested_bindin]" but maybe that's not worth the complexity)

@voodoos
Copy link
Collaborator

voodoos commented Oct 23, 2025

Sorry to be that guy, but I think the choice of option is unnecessary restrictive here. What if one day we add lenses for other things and want to have it finely configurable ? Then with an option named "only_toplevel" we are stuck.

Let's make it additive instead (there might be a better name for it): "for_nested_bindings" with a default to false.

Does that make sense ?

So you mean the name for the option is not really well-chosen?

The semantic of the option itself is too restrictive.

@Tim-ats-d
Copy link
Contributor Author

Tim-ats-d commented Oct 23, 2025

The semantic of the option itself is too restrictive.

Okay I think I see what you mean. I've changed the semantic of the option in my last commit. What do you think?

Copy link
Collaborator

@voodoos voodoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@voodoos voodoos merged commit b4cf816 into ocaml:master Oct 23, 2025
1 of 6 checks passed
@Tim-ats-d Tim-ats-d deleted the configurable-internal-code-lens branch October 23, 2025 13:53
davesnx added a commit to davesnx/ocaml-lsp that referenced this pull request Nov 3, 2025
…rmat-mlx

* 'master' of github.com:/ocaml/ocaml-lsp:
  Rename parameter used to configure nested bindings. (ocaml#1568)
  Upgrade to ocamlformat 0.28.1 (ocaml#1569)
  Improve precision of duration field in `view-metrics` (ocaml#1565)
  Make `code-lens` for toplevel let binding configurable (ocaml#1567)
  Fix 5.4 CI
  Enable support for OCaml 5.4 and prepare release 1.24.0 (ocaml#1559)
  Prepare release 1.23.1 (ocaml#1558)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants