From 77da27cac0ab7f36ae6a8ffbf48de1351148ff1a Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Sat, 8 Apr 2023 06:20:53 +0200 Subject: [PATCH] Improved rust neovim setup - Fixed crash using nvim-cmp - Added rust analyzer to neovim dependencies --- dotfiles/neovim/lua/my/plugins/cmp.lua | 6 +++++- home/adrielus/features/neovim/default.nix | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dotfiles/neovim/lua/my/plugins/cmp.lua b/dotfiles/neovim/lua/my/plugins/cmp.lua index 0ea0dc4..af703f2 100644 --- a/dotfiles/neovim/lua/my/plugins/cmp.lua +++ b/dotfiles/neovim/lua/my/plugins/cmp.lua @@ -53,7 +53,11 @@ function M.config() })(entry, vim_item) local strings = vim.split(kind.kind, "%s", { trimempty = true }) - kind.kind = " " .. strings[1] .. " " + -- Rust analyzer sometimes has this be nil when working with lifetime arguments. + if strings[1] ~= nil then + kind.kind = " " .. strings[1] .. " " + end + kind.menu = "" return kind diff --git a/home/adrielus/features/neovim/default.nix b/home/adrielus/features/neovim/default.nix index 4ce17a9..ecb2eb0 100644 --- a/home/adrielus/features/neovim/default.nix +++ b/home/adrielus/features/neovim/default.nix @@ -13,6 +13,7 @@ let nodePackages_latest.vscode-langservers-extracted # Web stuff python310Packages.python-lsp-server # Python pyright # Python + rust-analyzer # rust # Formatters luaformatter # Lua @@ -33,6 +34,7 @@ let nodePackages.typescript # typescript lua # For repls and whatnot wakatime # time tracking + rustfmt # Others fd # file finder