Skip to content

Can not rename a enum which has a certain derive macro thiserror::Error via LSP Server in Rust. #14823

@BoolPurist

Description

@BoolPurist

Summary

I can not rename a enum which has a certain derive macro, here thiserror::Error, via LSP Server in Rust.
I do not get even to the renaming prompt. Instead I get an error message protocol error: InvalidParams: No references found at position.

This problems seems to be helix and not rust analyzer because vscodium does not have the problem on my system.

This problems disappears when I remove the derive macro called thiserror::Error in the derive derective of the enum.

Reproduction Steps

Content of rust file producing this error

use std::io;
use std::path::PathBuf;

#[derive(Debug, thiserror::Error)]
pub enum NonExistinDirectory {
    #[error(
        "Could not determine meta data at {path:?} to determine if this is a directory. Error: {error}"
    )]
    Io { path: PathBuf, error: io::Error },
    #[error("There is no directory at {0:?}")]
    NotThere(PathBuf),
}

fn main() {
    println!("Hello, world!");
}

I tried this:

  1. Create a project via cargo new hello.
  2. Go into cd hello.
  3. Add thiserror crate to the project cargo add thiserror.
  4. Paste the above mentioned content to src/main.rs.
  5. hx src/main.rs within the diretory of the rust project.
  6. Move cursor to name of enum Name NonExistinDirectory .
  7. Press Space + r to rename the name of this enum.

I expected this to happen:

Prompt in the bottom to change the name of the enum.

Instead, this happened:

Got the following error where the prompt for renaming should be.

protocol error: InvalidParams: No references found at position

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

helix.log

Platform

Linux Fedora 43

Terminal Emulator

alacritty

Installation Method

DNF: Native Package Manager

Helix Version

helix 25.07.1 (a05c151)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions