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

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

Closed
fannheyward opened this issue Feb 29, 2024 · 2 comments
Labels
C-bug Category: bug

Comments

@fannheyward
Copy link
Contributor

fannheyward commented Feb 29, 2024

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

@fannheyward fannheyward added the C-bug Category: bug label Feb 29, 2024
@fannheyward
Copy link
Contributor Author

#16607

@lnicola
Copy link
Member

lnicola commented Feb 29, 2024

It's been fixed in #16618.

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

No branches or pull requests

2 participants