skip to Main Content

I have updated my arch setup and compiled neovim 0.9.1 on just installed Debian 12.

rust-analyzer doesn’t show any messages and doesn’t give any autocomplete suggestions.

rust-analyzer is installed by mason, by rustup component add and by npm install.

I also have added it to the PATH so there is no errors in it.

As i understand it runs (because it doesn’t throw any errors) but it just ignores the file content.

This is part of my config which is related to the issue.

vim.cmd [[packadd packer.nvim]]
require("packer").startup(function(use)
  use "wbthompson/packer.nvim"
  use "vim-airline/vim-airline"
  use 'vim-airline/vim-airline-themes'
  use 'ryanoasis/vim-devicons'
  use 'jpalardy/vim-slime'
  use 'shime/vim-livedown'
  use 'ap/vim-css-color'
  use 'terryma/vim-multiple-cursors'
  use 'mattn/emmet-vim'
  use 'scrooloose/nerdtree'
  use 'pacha/vem-tabline'
-- LSP
  use {
    'VonHeikemen/lsp-zero.nvim',
    requires = {
      -- LSP Support
      {'neovim/nvim-lspconfig'},
      {'williamboman/mason.nvim'},
      {'williamboman/mason-lspconfig.nvim'},

      -- Autocompletion
      {'hrsh7th/nvim-cmp'},
      {'hrsh7th/cmp-buffer'},
      {'hrsh7th/cmp-path'},
      {'saadparwaiz1/cmp_luasnip'},
      {'hrsh7th/cmp-nvim-lsp'},
      {'hrsh7th/cmp-nvim-lua'},
      {'hrsh7th/cmp-nvim-lsp-signature-help'},
      {'hrsh7th/cmp-vsnip'},
      {'hrsh7th/vim-vsnip'},

      -- Snippets
      {'L3MON4D3/LuaSnip'},
      {'rafamadriz/friendly-snippets'},
    },
    config = function ()
      require('mason.settings').set({
        log_level = vim.log.levels.DEBUG
      })
    end
  }
end)

require([[lspconfig]]).rust_analyzer.setup({
  on_attach = function (client, buff)
    print([[rust_analyzer is attached]])
  end,
  flags = {
    debounce_text_changes = 150
  },
  cmd = {
    [[rustup]],
    [[run]],
    [[stable]],
    [[rust-analyzer]],
    --    vim.env.HOME .. '/.cargo/bin/rust_analyzer'
  }
})

I have tried to install rust-tools and coc.nvim.
rust-tools bringed no changes.
coc.nvim didn’t respond at all.

I also tried to install package as it helped me here neovim's lsp does not show error messages but it didn’t help

If you need more info about my config here is the last I used before this issue https://github.com/onemorebruh/configs/tree/master/nvim

UPD: pyright doesn’t work as i expect it too

2

Answers


  1. Chosen as BEST ANSWER

    well i just deleted the previous project. did cargo new project_name and now it works. sorry for bothering.

    the same with pyright. i just did git clone and lsp started to work.


  2. I just had a similar issue – rust-analyzer did work, except for warnings/diagnostics.

    After reading your own answer and wondering why re’loading the project helps, I did run

    cargo clean
    

    … and it worked again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search