How to Configure Inlay Hints in Rust Analyzer with Neovim Using nvim-cmp and nvim-lspconfig

545 views Asked by At

I'm setting up a Rust development environment in Neovim and am looking to enable inlay hints using rust-analyzer. My setup includes nvim-cmp and nvim-lspconfig, but I'm not interested in using rust-tools.nvim or mrcjkb/rustaceanvim.

My current configuration for rust-analyzer in Neovim is as follows:

require('lspconfig').rust_analyzer.setup({
    on_attach=on_attach,
    settings = {
        ["rust-analyzer"] = {
            imports = {
                granularity = {
                    group = "module",
                },
                prefix = "self",
            },
            cargo = {
                buildScripts = {
                    enable = true,
                },
            },
            procMacro = {
                enable = true
            },
        }
    }
})

Despite this setup, I am unable to get inlay hints to display. The rest of the rust-analyzer features, such as code jumping, are working perfectly. Could anyone provide guidance on how to correctly enable inlay hints with this configuration, or suggest what might be missing or incorrect?

0

There are 0 answers