autocomplete not working with cmp, even though it works with every other language(on NixOS)? #523
-
Howdy,
however I do not think that these errors would cause autocomplete to stop working? i have autocomplete with every other language and have commented out my rustaceanvim config and it still seems to not work. I am not calling lspconfig at all to my knowledge. I am at a loss here. any pointers to fix this issue would be great. I have looked at similair discussions. and this is my capabilities block:
when I call this and have no other config it still doesnt seem to work, i apologize profusely if there is a trivial solution. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
hey 👋 rustaceanvim auto-detects cmp_nvim_lsp and registers the capabilities, so you shouldn't need to do that manually. Although I doubt that's what's causing your issue. It's most likely related to your project or rust-analyzer build. |
Beta Was this translation helpful? Give feedback.
-
this is the flake I used for the dev shell: {
description = "rustacean flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rustacean.url = "github:mrcjkb/rustaceanvim";
};
outputs = { self, nixpkgs, rustacean, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in
{
devShells.${system}.default = pkgs.mkShell
{
buildInputs = with pkgs;[
clang
libclang
rocmPackages_6.llvm.clang-unwrapped
libgcc
glib
gcc-unwrapped
llvm_18
pkg-config
clang-tools
rustacean.packages.${system}.codelldb
rustc
rustup
rustfmt
rust-analyzer
cargo
];
shellHook = ''
rustup default stable
rustup component add clippy
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$PATH:${rustacean.packages.${system}.codelldb}/bin"
export PATH="${pkgs.rust-analyzer}/bin:$PATH"
export PATH="$PATH:${pkgs.rustfmt}/bin"
'';
};
};
} and I used the nix run on nightly and there was still no autocomplete |
Beta Was this translation helpful? Give feedback.
-
In case it helps anyone out there, I wasn't getting rust completions until I added this explicit dependency in my (lazy) configuration: return {
"mrcjkb/rustaceanvim",
version = "^5", -- Recommended
lazy = false, -- This plugin is already lazy
dependencies = {
{ "hrsh7th/cmp-nvim-lsp" }, -- <-- added this
}
} |
Beta Was this translation helpful? Give feedback.
nvim-cmp doesn't work if you don't call its
setup
function.Instead of
pkgs
for your rust toolchain (cargo, rustc, ...), I recommend usingpkgs.rustPlatform
.In general, there's not much I can do to help you when it comes to problems with autocompletion, because rustaceanvim doesn't implement autocompletion.
So the way to troubleshoot this is by bisecting your other plugins and troubleshootin…