Skip to content

Hover bounds caching is messing with some clients #4751

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

Open
3 tasks done
mattiasdrp opened this issue Apr 2, 2025 · 1 comment
Open
3 tasks done

Hover bounds caching is messing with some clients #4751

mattiasdrp opened this issue Apr 2, 2025 · 1 comment
Labels

Comments

@mattiasdrp
Copy link
Contributor

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

As you can see in the following video, this piece of code in lsp-eldoc-function is messing with the lsp-ocaml client

  (if (and lsp--hover-saved-bounds
           (lsp--point-in-bounds-p lsp--hover-saved-bounds))
      lsp--eldoc-saved-message
Enregistrement.d.ecran_20250402_153634.webm

When the point is on struct, the saved bounds includes the function in the module and the hover is not computed resulting in a faulty returned type.

Steps to reproduce

  • Start emacs with lsp-start-plain.el
  • Register the ocaml-lsp-client
    (lsp-register-client
     (make-lsp-client
      :new-connection (lsp-stdio-connection
                       '("opam" "exec" "--" "ocamllsp"))
      :major-modes '(caml-mode tuareg-mode)
      :server-id 'ocaml-lsp-server))
  • Install the ocaml-lsp-server
  • Create any OCaml file with
    let a = 3
    
    module A = struct
      let f a b c d e f = a + b + c + d + e + f
    end
  • Hover over f (int -> int -> int -> int -> int -> int -> int)
  • Hover over struct (sig)
  • Hover back to f (previous type sig is displayed)
  • Hover over a (int)
  • Hover back to f (int -> int -> int -> int -> int -> int -> int)

Expected behavior

When hover over a value inside a module the type of the value should be displayed, not the type of the enclosing module.

Which Language Server did you use?

lsp-ocaml

OS

Linux

Error callstack

Anything else?

No response

@mattiasdrp mattiasdrp added the bug label Apr 2, 2025
@mattiasdrp
Copy link
Contributor Author

One simple solution could be to add a custom value that allows to not cache the hover bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant