hover.nvim icon indicating copy to clipboard operation
hover.nvim copied to clipboard

Rust and Cargo.toml providers?

Open dsully opened this issue 3 years ago • 1 comments

I currently have a textDocument/hover handler that looks like this:

function M.hover()

    if vim.bo.filetype == "rust" then
        require("rust-tools.hover_actions").hover_actions()
    elseif vim.fn.expand("%:t", false, false) == "Cargo.toml" then
        require("crates").show_popup()
    else
        require("hover").hover()

        require("autocommands")("DisableCursorHold")(function(autocmd)
            vim.opt.eventignore:append("CursorHold")

            autocmd(
                { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" },
                { pattern = "<buffer>", once = true, desc = "Prevent floating diagnostic from opening while hover is opened." },
                function()
                    vim.opt.eventignore:remove("CursorHold")
                end
            )
        end)
    end
end

And wanted to see about making both the rust-tools.nvim and crates.nvim actions be hover.nvim providers. However, both of these manage their own popup windows.

Any ideas here, or should I continue with this approach?

Thanks

dsully avatar Sep 05 '22 20:09 dsully

You would need to deconstruct the functions so you can populate the windows manually via a provider.

lewis6991 avatar Sep 05 '22 21:09 lewis6991