rust-tools.nvim icon indicating copy to clipboard operation
rust-tools.nvim copied to clipboard

rust-tools: hover_with_actions is deprecated, please setup a keybind to :RustHoverActions is on_attach instead

Open ligmaSec opened this issue 3 years ago • 5 comments

this error appeared since the last update and I have no idea how to make it disappear, tried adding a keybind using noremap, didnt work

nvim version = v0.7.2

ligmaSec avatar Aug 18 '22 21:08 ligmaSec

What does your setup look like?

simrat39 avatar Aug 18 '22 21:08 simrat39

init.vim


call plug#begin()
Plug 'andweeb/presence.nvim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'neovim/nvim-lspconfig'
Plug 'simrat39/rust-tools.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/vim-vsnip'
call plug#end()

lua require'lspconfig'.rust_analyzer.setup({})

" Set completeopt to have a better completion experience
" :help completeopt
" menuone: popup even when there's only one match
" noinsert: Do not insert text until a selection is made
" noselect: Do not select, force user to select one from the menu
set completeopt=menuone,noinsert,noselect

" Avoid showing extra messages when using completion
set shortmess+=c

" Configure LSP through rust-tools.nvim plugin.
" rust-tools will configure and enable certain LSP features for us.
" See https://github.com/simrat39/rust-tools.nvim#configuration
lua <<EOF
local nvim_lsp = require'lspconfig'

local opts = {
    tools = { -- rust-tools options
        autoSetHints = true,
        hover_with_actions = false,
        inlay_hints = {
            show_parameter_hints = false,
            parameter_hints_prefix = "",
            other_hints_prefix = "",
        },
    },

    -- all the opts to send to nvim-lspconfig
    -- these override the defaults set by rust-tools.nvim
    -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
    server = {
        -- on_attach is a callback called when the language server attachs to the buffer
        -- on_attach = on_attach,
        settings = {
            -- to enable rust-analyzer settings visit:
            -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
            ["rust-analyzer"] = {
                -- enable clippy on save
                checkOnSave = {
                    command = "clippy"
                },
            }
        }
    },
}

require('rust-tools').setup(opts)
EOF

" Setup Completion
" See https://github.com/hrsh7th/nvim-cmp#basic-configuration
lua <<EOF
local cmp = require'cmp'
cmp.setup({
  -- Enable LSP snippets
  snippet = {
    expand = function(args)
        vim.fn["vsnip#anonymous"](args.body)
    end,
  },
  mapping = {
    ['<C-p>'] = cmp.mapping.select_prev_item(),
    ['<C-n>'] = cmp.mapping.select_next_item(),
    -- Add tab support
    ['<S-Tab>'] = cmp.mapping.select_prev_item(),
    ['<Tab>'] = cmp.mapping.select_next_item(),
    ['<C-d>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.close(),
    ['<CR>'] = cmp.mapping.confirm({
      behavior = cmp.ConfirmBehavior.Insert,
      select = true,
    })
  },

  -- Installed sources
  sources = {
    { name = 'nvim_lsp' },
    { name = 'vsnip' },
    { name = 'path' },
    { name = 'buffer' },
  },
})
EOF ```

I managed to get rid of the error by setting hover_with_actions to false, but I would like to setup a keybind to :RustHoverActions
do you have any idea ?

thanks

ligmaSec avatar Aug 19 '22 12:08 ligmaSec

https://github.com/simrat39/rust-tools.nvim#setup Just follow the instructions here, hover_with_actions was removed so that's why the warning is there.

simrat39 avatar Aug 19 '22 23:08 simrat39

And make sure you removed the option hover_with_actions = true in

local opts = {
    -- ...
    tools = {
        -- ...
        hover_with_actions = true, --< Remove that property
    },
}
require('rust-tools').setup(opts)

liketurbo avatar Nov 09 '22 12:11 liketurbo

@simrat39 Now, I think it's safe to close this issue 🤔

liketurbo avatar Nov 09 '22 12:11 liketurbo