simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.16k stars 158 forks source link

auto_focus option not working #273

Open Lisieshy opened 1 year ago

Lisieshy commented 1 year ago

I'm currently using AstroNvim Version v2.4.2.

My issue is that the auto_focus option doesn't do anything. I still have to call RustHoverActions twice for it to focus in the hover window.

I configured the rust-tools plugin using the official AstroNvim Documentation and added the tools.hover_actions.auto_focus to true.

Here is a snippet of my config (config.plugins.init)

  -- Configure plugins
  plugins = {
    init = {
      {
        "simrat39/rust-tools.nvim",
        after = { "mason-lspconfig.nvim" }, -- make sure to load after mason-lspconfig
        config = function()
          require("rust-tools").setup {
            server = astronvim.lsp.server_settings "rust_analyzer", -- get the server settings and built in capabilities/on_attach
            opts = {
              tools = {
                hover_actions = { auto_focus = true },
              },
            }
          }
        end,
      },

Did I forget anything in the setup process ?

londospark commented 1 year ago

I'm getting the same in neovim 0.8

n3ry7 commented 1 year ago

same here in neovim 0.8

simrat39 commented 1 year ago

Is there any guaranteed reproduction? Seems to work fine for me

tobias-edwards commented 10 months ago

Natively, to configure auto_focus, you wanna move tools outside of your opts:

require("rust-tools").setup({
  ...
  tools = {
    hover_actions = {
      auto_focus = true,
    },
  },
})

Perhaps AstroNvim is not respecting this structure?