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

Inconsistent behavior with rust-analyzer #2106

Open
2 tasks done
DrakulaD3a opened this issue Dec 5, 2024 · 8 comments
Open
2 tasks done

Inconsistent behavior with rust-analyzer #2106

DrakulaD3a opened this issue Dec 5, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@DrakulaD3a
Copy link

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'

require"mason".setup()
require"mason-lspconfig".setup({
  ensure_installed = { "rust_analyzer" },
})
require"mason-lspconfig".setup_handlers({
  function(server)
    require"lspconfig"[server].setup({
      capabilities = require"cmp_nvim_lsp".default_capabilities(capabilities),
    })
  end,
})

Description

When using nvim-cmp with rust-analyzer, showed completions are different from the completions, that actually get inserted. This happens only with rust-analyzer, no other lsp that I used.

Steps to reproduce

Just use the completion with the provided config

Expected behavior

Normal completion

Actual behavior

Completion of seemingly unrelated items

Additional context

With my config:

Bug.mp4

With minimal config:

Bug_minimal.mp4
@DrakulaD3a DrakulaD3a added the bug Something isn't working label Dec 5, 2024
@hejops
Copy link

hejops commented Dec 7, 2024

I've noticed this as well. Another way to trigger this odd behaviour is to type something like 'x'. and (try to) select to_owned(). This completes partial_cmp on my system.

My config is below:

local cmp = require("cmp")
cmp.setup({
	snippet = {
		expand = function(args)
			require("luasnip").lsp_expand(args.body)
		end,
	},
	mapping = cmp.mapping.preset.insert({
		["<cr>"] = cmp.mapping.confirm({
			behavior = cmp.ConfirmBehavior.Replace,
			select = true,
		}),
	},
})

In comparison, Python (Pyright) and Go (gopls) are unaffected.

@hejops
Copy link

hejops commented Dec 7, 2024

FWIW, updating rust-analyzer to 2024-12-02 resolved my issue.

@kyoryo
Copy link

kyoryo commented Dec 8, 2024

I still got this issue even after updating rust-analyzer to the mentioned version above.
image

Did you change anything after updating @hejops ?

@hejops
Copy link

hejops commented Dec 8, 2024

I did not, unfortunately.

hejops added a commit to hejops/dotfiles that referenced this issue Dec 8, 2024
@kyoryo
Copy link

kyoryo commented Dec 10, 2024

It's the analyzer problem, not cmp. rust-lang/rust-analyzer#18547

@hrsh7th
Copy link
Owner

hrsh7th commented Dec 10, 2024

IMO, this bug is solved by IMO, current cmp-nvim-lsp has no this problem by hrsh7th/cmp-nvim-lsp#77 .

Could you update cmp-nvim-lsp?

@hrsh7th
Copy link
Owner

hrsh7th commented Dec 10, 2024

Oh, sorry. I guess I misunderstood. It looks like we need to fix rust-analyzer, so please wait.

@kyoryo
Copy link

kyoryo commented Dec 18, 2024

This issue is resolved by updating rust-analyzer to 2024-12-16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants