This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 156
Cannot enable inlay hints #430
Comments
Quick little update, the entire table only consists of |
I looked into your nvim config in your repo, and I saw that you are using mason_lspconfig.setup_handlers to install the capabilities. This function will setup all of your LSPs detected by Mason.
This means, that Mason sets up rust_analyzer for you, not your configuration. Try to change your config to be something like this: local handlers = {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end,
["rust_analyzer"] = function() -- This will "skip" setting up rust_analyzer
end
}
mason_lspconfig.setup_handlers(handlers) To setup the rust_analyzer, you want to call the modified version of on_attach function, since you want to add another keymappings. Maybe something like this: local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
on_attach(_, bufnr) -- This calls your default on_attach function, so every keymap will be loaded correctly
vim.keymap.set("n", "<leader>ca", require("rust-tools.code_action_group").code_action_group, { buffer = bufnr})
vim.keymap.set("n", "<leader>ha", require("rust-tools.hover_actions").hover_actions, { buffer = bufnr})
end,
},
}) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It is impossible to enable inlay hints, since neither the lua function nor the command are defined.
returns nil
The text was updated successfully, but these errors were encountered: