I am currently using neovim nightly and though I am getting InlayHints for rust it is only parameter types I am not getting lifetime ellision hints on trying to change the configuration I saw on the rust_analyzer docs..
I have tried multiple approaches like using setup_handlers
of mason-lspconfig.
Trying to setup the lsp outside of the mason-lspconfig.
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
callback = function(event)
local opts = { buffer = event.buf }
vim.keymap.set("n", '<C-i>', function() vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled(0)) end,
opts)
end,
})
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = { 'tsserver', 'rust_analyzer', 'clangd' },
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({
capabilities = lsp_capabilities,
})
end,
rust_analyzer = function()
require('lspconfig').rust_analyzer.setup({
capabilities = lsp_capabilities,
settings = {
['rust_analyzer'] = {
inlayHints = {
lifetimeElisionHints = {
enable = "always",
useParameterNames = true
}
},
}
}
})
end
}
})