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

Haskell extension triggers an error when trying to initiate a rename #24184

Open
isomorpheme opened this issue Feb 4, 2025 · 2 comments · May be fixed by #24246
Open

Haskell extension triggers an error when trying to initiate a rename #24184

isomorpheme opened this issue Feb 4, 2025 · 2 comments · May be fixed by #24246
Labels
language server failure Language server doesn't work as expected

Comments

@isomorpheme
Copy link

Summary

When trying to rename an identifier in Haskell code, nothing happens and I get this error instead:

Invalid for language server to send a `defaultBehavior` response to `prepareRename`

Steps to trigger the problem:

  1. Open a Haskell project (haskell-language-server version: 2.9.0.0 (GHC: 9.6.6)).
  2. Make sure HLS is otherwise functioning.
  3. Try to rename an identifier (e.g. a top-level function).

Actual Behavior:

The rename input never appears and I get an error.

Expected Behavior:

I'm allowed to enter the new name as usual.


This could very well be an upstream problem of HLS not correctly implementing the language server protocol. But things were working fine until a few versions ago, so I'm not sure if Zed needs to be that strict about it. haskell/haskell-language-server#3130 might also be related, though this also happens for identifiers in modules with an explicit export list that are not exported.

Zed Version and System Specs

Zed: v0.171.4 (Zed)
OS: Linux Wayland ubuntu 24.04
Memory: 30.8 GiB
Architecture: x86_64
GPU: Intel(R) Arc(tm) Graphics (MTL) || Intel open-source Mesa driver || Mesa 24.0.9-0ubuntu0.3

@probably-neb
Copy link
Contributor

I agree with you it seems like hls is returning an invalid/unexpected response that we should probably consider being less strict about. Thanks for reporting this!

@probably-neb probably-neb added the language server failure Language server doesn't work as expected label Feb 4, 2025
@osiewicz
Copy link
Contributor

osiewicz commented Feb 4, 2025

This is just a LSP spec incompatibility (we don't support defaultBehavior). There was actually a recent fix for Gleam where prepareRename did not work for them either.
Granted, a language server should check with the capabilities we send out to see if they can use DefaultBehaviour in the first place.. so it's also a bug on Haskell Language Server side too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language server failure Language server doesn't work as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants