Skip to content
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

OCaml 5.0 -> 5.1+: functions with explicit type signatures no longer show up in code lens and symbol list #1256

Open
edwintorok opened this issue May 12, 2024 · 0 comments

Comments

@edwintorok
Copy link
Contributor

edwintorok commented May 12, 2024

Open the following file with an editor that is connected to OCaml LSP 1.17.0, and notice that some functions are missing a code lens, or are missing from the symbol list

(run a dune clean before, just in case):

type style = [ `Bold | `Italic | `Emphasis | `Superscript | `Subscript ]

let string_of_style : style -> string  = function
  | `Bold -> "bold"
  | `Italic -> "italic"
  | `Emphasis -> "emphasis"
  | `Superscript -> "superscript"
  | `Subscript -> "subscript"

let string_of_style2  = function
  | `Bold -> "bold"
  | `Italic -> "italic"
  | `Emphasis -> "emphasis"
  | `Superscript -> "superscript"
  | `Subscript -> "subscript"

Results:

(space s: list symbols)

  • Helix + OCaml 4.14.1: string_of_style2, string_of_style, style
  • Helix + OCaml 5.0: string_of_style2, string_of_style, style
  • Helix +OCaml 5.1.1: string_of_style2, style
  • Helix + OCaml 5.2.0-rc1 + ocaml-lsp 1.18.0~5.2preview: string_of_style2, style

Outline (VSCodium), select a different sandbox every time:

  • 5.0.0: style, string_of_style, string_of_style2
  • 5.1.1: style, string_of_style2

Enable all LSP features (Code lens, etc):

  • 5.0.0: b50
  • 5.1.1: b51

This seems to indicate that the problem is some change between OCaml 5.0.0 and 5.1.1, the LSP server is the same.

I can understand hiding the code lens (the type annotation is already there), but there is no reason to remove it from the global symbols list, that is a bug.
Also even if it might desirable to hide the code lens when explicit type annotations are available, that behaviour should be consistent across compiler versions.

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

No branches or pull requests

1 participant