Rust-analyzer does not show items from unimported external crates

rust-analyzer does not show items from unimported external crates, using nvim-compe for the completion side. This is not the case in vscode or even coc-rust-analyzer so i suspect it could be something to do with my config.

Add this to your rust_analyzer lsp config (Thanks @hrsh7th)
This will enable autoimport capability.

    capabilities = (function()
      local capabilities = vim.lsp.protocol.make_client_capabilities()
      capabilities.textDocument.completion.completionItem.snippetSupport = true
      capabilities.textDocument.completion.completionItem.resolveSupport = {
        properties = {
      return capabilities

This should probably put in the readme somewhere, either nvim-compe or nvim-lspconfig.

1 Like

Note (for others) we don’t actually have an implementation for completionItem.resolveSupport (yet), snippets is fine if you’re using a snippet plugin. I’m not sure why you need to signal resolveSupport for RA to return all of the completion items (as in, why RA requires this). There’s an open PR for resolveSupport.

1 Like