Skip to content

Feature request: rename messages from referenced site #129

@skagedal

Description

@skagedal

Thank for this useful tool, I am using it through Zed as a language server for mostly gRPC protobuf files.

I would like to be able to rename messages from where they are referenced. For example:

service FooService {
  rpc GetFoo(GetFooRequest) returns (GetFooResponse);
}

message GetFooRequest {
}

message GetFooResponse {
}

To rename GetFooRequest, I have to do it from the declaration of the message, not directly from within the referencing service.

I am not too well acquainted with LSP – according to my coding agent it should be within the LSP's control:

That's the LSP's decision, not Zed's. prepare_rename in protols (src/parser/rename.rs:9-24) only returns a valid range when the identifier's parent is a message_name or enum_name. In an rpc DoThing(MyRequest) returns (MyResponse); line, the MyRequest token's parent in the tree-sitter grammar is message_or_enum_type (confusingly stored as NodeKind::FieldName in this codebase), not message_name. So protols says "can't rename here" and Zed correctly surfaces that, forcing you to go-to-definition first.

Sorry if that's confused!

If this sounds like a useful addition, I would be happy to dig deeper and attempt a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions