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

Implement missing members introduces a \ before the curly braces of functions of a trait #17219

Open
vaporif opened this issue May 12, 2024 · 8 comments
Labels
C-bug Category: bug C-support Category: support questions

Comments

@vaporif
Copy link

vaporif commented May 12, 2024

Implementing trait inserts \} at the end

impl Add for Vec3 {
    type Output;

    fn add(self, rhs: Self) -> Self::Output {
        todo!()
    \}
}

Seems like regression of #16607

Works fine on 1.77.2

rust-analyzer version: rust-analyzer 1.78.0 (9b00956e 2024-04-29)

rustc version: rustc 1.78.0 (9b00956e5 2024-04-29)

editor or extension: neovim standard mason setup

relevant settings: n/a

@vaporif vaporif added the C-bug Category: bug label May 12, 2024
@lnicola
Copy link
Member

lnicola commented May 13, 2024

Can you test using a binary downloaded from GitHub instead of the rustup version?

@lnicola lnicola added the C-support Category: support questions label May 13, 2024
@roife
Copy link
Member

roife commented May 13, 2024

Might be similar to #16867.

@Veykril
Copy link
Member

Veykril commented May 13, 2024

Also make sure to update your editor stuff (editor itself, and lsp integration if separate)

@alexniver
Copy link

same issue on archlinux, neovim, mason

rustc 1.79.0 (129f3b996 2024-06-10)
rust-analyzer 1.79.0 (129f3b9 2024-06-10)
impl Default for RenderResource {
    fn default() -> Self {
        Self { state: Default::default(), pos_to_render_arr: Default::default() \}
    \}
}

@roife
Copy link
Member

roife commented Jun 15, 2024

same issue on archlinux, neovim, mason


rustc 1.79.0 (129f3b996 2024-06-10)

rust-analyzer 1.79.0 (129f3b9 2024-06-10)


impl Default for RenderResource {

    fn default() -> Self {

        Self { state: Default::default(), pos_to_render_arr: Default::default() \}

    \}

}



See #16867 (comment), it is likely an issue on the neovim-side.

@alexniver
Copy link

same issue on archlinux, neovim, mason


rustc 1.79.0 (129f3b996 2024-06-10)

rust-analyzer 1.79.0 (129f3b9 2024-06-10)

impl Default for RenderResource {

    fn default() -> Self {

        Self { state: Default::default(), pos_to_render_arr: Default::default() \}

    \}

}

See #16867 (comment), it is likely an issue on the neovim-side.

em..., according to #16867

neovim/neovim#25611 should fix this issue. this PR is merged to Neovim 0.10.0

my neovim now is 0.10.0, this issue doesn't fix.

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info

should I file a issue to neovim?

@alexniver
Copy link

I did some research on this issue,

neovim version: 0.11 dev

rustc 1.79.0 (129f3b996 2024-06-10)
rust-analyzer 1.79.0 (129f3b9 2024-06-10)

when i choose implement missing member,
neovim run client.request(ms.codeAction_resolve, action, function(err, resolved_action), return resolved_action

{
  edit = {
    documentChanges = { {
        edits = { {
            insertTextFormat = 2,
            newText = "\n    $0fn default() -> Self {\n        Self {  \\}\n    \\}\n",
            range = {
              ["end"] = {
                character = 24,
                line = 11
              },
              start = {
                character = 24,
                line = 11
              }
            }
          } },
        textDocument = {
          uri = "file:///home/zhulin/dev/rust/test/test_any/src/main.rs",
          version = 0
        }
      } }
  },
  kind = "quickfix",
  title = "Implement missing members"
}

is resolved_action generated by rust-analyzer? newText not right here.

@roife
Copy link
Member

roife commented Jun 28, 2024

I did some research on this issue,

neovim version: 0.11 dev

rustc 1.79.0 (129f3b996 2024-06-10)
rust-analyzer 1.79.0 (129f3b9 2024-06-10)

when i choose implement missing member, neovim run client.request(ms.codeAction_resolve, action, function(err, resolved_action), return resolved_action

{
  edit = {
    documentChanges = { {
        edits = { {
            insertTextFormat = 2,
            newText = "\n    $0fn default() -> Self {\n        Self {  \\}\n    \\}\n",
            range = {
              ["end"] = {
                character = 24,
                line = 11
              },
              start = {
                character = 24,
                line = 11
              }
            }
          } },
        textDocument = {
          uri = "file:///home/zhulin/dev/rust/test/test_any/src/main.rs",
          version = 0
        }
      } }
  },
  kind = "quickfix",
  title = "Implement missing members"
}

is resolved_action generated by rust-analyzer? newText not right here.

It seems that the 'implement missing members' works correctly in v0.11.0-dev+0e3e1e6. Could you check if the issue might be due to your plugins or the distribution you are using?

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

No branches or pull requests

5 participants