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

Configuration with rust analyzer #15

Closed
jackpeters667 opened this issue Aug 11, 2021 · 13 comments
Closed

Configuration with rust analyzer #15

jackpeters667 opened this issue Aug 11, 2021 · 13 comments

Comments

@jackpeters667
Copy link

Hi there. Thanks for the plugin.
How would I attach this completion engine to rust analyzer's LSP?

@etrnal70
Copy link

You need to install additional source for nvim-lsp

@jackpeters667
Copy link
Author

jackpeters667 commented Aug 12, 2021

You need to install additional source for nvim-lsp

I think my question is how to attach the source to nvim-cmp because I have nvim-lsp installed. I tried listing nvim-lsp under sources but no dice. Tried rust-analyzer second, nothing also.
If you get a gap, please have a look and let me know how I should modify the config. I attached my pastebin link.

lang.vim

@etrnal70
Copy link

Instead of the server name, you should use the source name

sources = {
      { name = 'buffer' },
      { name = 'nvim_lsp' },
    },

@jackpeters667
Copy link
Author

Awesome. I'm getting completions now, auto imports aren't working though.
Is there something else I need to check?

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 12, 2021

Did you set up the cmp-nvim-lsp's README.md?
https://github.com/hrsh7th/cmp-nvim-lsp

@jackpeters667
Copy link
Author

Did you set up the cmp-nvim-lsp's README.md?
https://github.com/hrsh7th/cmp-nvim-lsp

Yeah, I did.
Line 61 here

Is that it?

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 12, 2021

auto-import is works in my environment. I can't repro

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 12, 2021

Ah. Your config has no mapping option.

@jackpeters667
Copy link
Author

Was about to ask for your mapping lol. Could you share please?

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 12, 2021

Please read README.md https://github.com/hrsh7th/nvim-cmp#readme

@jackpeters667
Copy link
Author

Yeah I had that before but I got some errors,

Error executing lua [string ":lua"]:30: attempt to call field 'prev_item' (a nil value)

So I moved it out and tried to use inoremap, which wouldn't work

@hrsh7th
Copy link
Owner

hrsh7th commented Aug 12, 2021

Please update plugin and set mapping oprion.

@jackpeters667
Copy link
Author

Ahh all good now. Thanks buddy

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

No branches or pull requests

3 participants