Skip to content

2024-02-19 release returns different newText for Implement missing members compares before release #16714

Closed
@fannheyward

Description

rust-analyzer https://github.com/rust-lang/rust-analyzer/releases/tag/2024-02-19 release returns different or error newText for Implement missing members quickfix, different with 2024-02-12 and before releases.

code snippet to reproduce:

struct Hi {
    field: String,
}
    
impl std::fmt::Debug for Hi {
}
  1. request code action on std::fmt::Debug error
  2. apply Implement missing members

2024-02-19 release result (omit unnecessary text), the end text is \\}\n.

Received response 'codeAction/resolve - (22)' in 14ms.
Result: {
    "title": "Implement missing members",
    "kind": "quickfix",
    "edit": {
        "documentChanges": [
            {
                "textDocument": ...,
                "edits": [
                    {
                        "range": ...,
                        "newText": "\n    $0fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.debug_struct(\"Hi\").field(\"field\", &self.field).finish()\n    \\}\n",
                        "insertTextFormat": 2
                    }
                ]
            }
        ],
        "changeAnnotations": ...
    }
}

2024-02-12 release, the end is }\n

Received response 'codeAction/resolve - (31)' in 12ms.
Result: {
    "title": "Implement missing members",
    "kind": "quickfix",
    "edit": {
        "documentChanges": [
            {
                "textDocument": ...,
                "edits": [
                    {
                        "range": ...,
                        "newText": "\n    $0fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.debug_struct(\"Hi\").field(\"field\", &self.field).finish()\n    }\n",
                        "insertTextFormat": 2
                    }
                ]
            }
        ],
        "changeAnnotations": ...
    }
}

2024-02-19 release added \\, is this expected or something error? This made the client applied error text fannheyward/coc-rust-analyzer#1228

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions